Update auto_charge.ts

This commit is contained in:
Nicolas 2024-10-25 16:05:39 -03:00
parent 95c4652fd4
commit 97b8d6c333

View File

@ -13,7 +13,7 @@ import { Logger } from "../../lib/logger";
// Define the number of credits to be added during auto-recharge // Define the number of credits to be added during auto-recharge
const AUTO_RECHARGE_CREDITS = 1000; const AUTO_RECHARGE_CREDITS = 1000;
const AUTO_RECHARGE_COOLDOWN = 600; // 10 minutes in seconds const AUTO_RECHARGE_COOLDOWN = 300; // 5 minutes in seconds
/** /**
* Attempt to automatically charge a user's account when their credit balance falls below a threshold * Attempt to automatically charge a user's account when their credit balance falls below a threshold
@ -29,7 +29,7 @@ export async function autoCharge(
try { try {
// Check if the team is in the cooldown period // Check if the team is in the cooldown period
// Another check to prevent race conditions, double charging - cool down of 10 minutes // Another check to prevent race conditions, double charging - cool down of 5 minutes
const cooldownValue = await getValue(cooldownKey); const cooldownValue = await getValue(cooldownKey);
if (cooldownValue) { if (cooldownValue) {
Logger.info(`Auto-recharge for team ${chunk.team_id} is in cooldown period`); Logger.info(`Auto-recharge for team ${chunk.team_id} is in cooldown period`);