Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(auto_charge): add more logs and extend lock duration

Gergő Móriczdc7755a9e392
diff --git a/apps/api/src/services/billing/auto_charge.ts b/apps/api/src/services/billing/auto_charge.ts
index 274d4240b..7b9fe2565 100644
--- a/apps/api/src/services/billing/auto_charge.ts
+++ b/apps/api/src/services/billing/auto_charge.ts
@@ -74,7 +74,8 @@ async function _autoChargeScale(
const resource = `auto-recharge:${chunk.team_id}`;
try {
- return await redlock.using([resource], 5000, async signal => {
+ return await redlock.using([resource], 15000, async signal => {
+ logger.info("Lock acquired");
const updatedChunk = await getACUC(chunk.api_key, false, false);
if (
@@ -302,6 +303,7 @@ async function _autoChargeScale(
true,
);
+ logger.info("Scale auto-recharge successful");
return {
success: true,
message: "Auto-recharge successful",