11// Import necessary dependencies and types
22import { AuthCreditUsageChunk } from "../../controllers/v1/types" ;
3- import { getACUC , setCachedACUC } from "../../controllers/auth" ;
3+ import { getACUC } from "../../controllers/auth" ;
44import { redlock } from "../redlock" ;
55import { supabase_service } from "../supabase" ;
66import { createPaymentIntent } from "./stripe" ;
@@ -9,7 +9,7 @@ import { sendNotification } from "../notification/email_notification";
99import { NotificationType } from "../../types" ;
1010import { deleteKey , getValue , setValue } from "../redis" ;
1111import { sendSlackWebhook } from "../alerts/slack" ;
12- import { Logger } from "../../lib/logger" ;
12+ import { logger } from "../../lib/logger" ;
1313
1414// Define the number of credits to be added during auto-recharge
1515const AUTO_RECHARGE_CREDITS = 1000 ;
@@ -32,7 +32,7 @@ export async function autoCharge(
3232 // Another check to prevent race conditions, double charging - cool down of 5 minutes
3333 const cooldownValue = await getValue ( cooldownKey ) ;
3434 if ( cooldownValue ) {
35- Logger . info ( `Auto-recharge for team ${ chunk . team_id } is in cooldown period` ) ;
35+ logger . info ( `Auto-recharge for team ${ chunk . team_id } is in cooldown period` ) ;
3636 return {
3737 success : false ,
3838 message : "Auto-recharge is in cooldown period" ,
@@ -59,7 +59,7 @@ export async function autoCharge(
5959 . single ( ) ;
6060
6161 if ( customersError ) {
62- Logger . error ( `Error fetching customer data: ${ customersError } ` ) ;
62+ logger . error ( `Error fetching customer data: ${ customersError } ` ) ;
6363 return {
6464 success : false ,
6565 message : "Error fetching customer data" ,
@@ -124,7 +124,7 @@ export async function autoCharge(
124124 false ,
125125 process . env . SLACK_ADMIN_WEBHOOK_URL
126126 ) . catch ( ( error ) => {
127- Logger . debug ( `Error sending slack notification: ${ error } ` ) ;
127+ logger . debug ( `Error sending slack notification: ${ error } ` ) ;
128128 } ) ;
129129
130130 // Set cooldown for 1 hour
@@ -138,7 +138,7 @@ export async function autoCharge(
138138 chunk : { ...chunk , remaining_credits : chunk . remaining_credits + AUTO_RECHARGE_CREDITS } ,
139139 } ;
140140 } else {
141- Logger . error ( "No Stripe customer ID found for user" ) ;
141+ logger . error ( "No Stripe customer ID found for user" ) ;
142142 return {
143143 success : false ,
144144 message : "No Stripe customer ID found for user" ,
@@ -147,7 +147,7 @@ export async function autoCharge(
147147 } ;
148148 }
149149 } else {
150- Logger . error ( "No sub_user_id found in chunk" ) ;
150+ logger . error ( "No sub_user_id found in chunk" ) ;
151151 return {
152152 success : false ,
153153 message : "No sub_user_id found in chunk" ,
@@ -165,7 +165,7 @@ export async function autoCharge(
165165
166166 } ) ;
167167 } catch ( error ) {
168- Logger . error ( `Failed to acquire lock for auto-recharge: ${ error } ` ) ;
168+ logger . error ( `Failed to acquire lock for auto-recharge: ${ error } ` ) ;
169169 return {
170170 success : false ,
171171 message : "Failed to acquire lock for auto-recharge" ,
0 commit comments