try {
//
} catch (error) {
console.error(
"x QUEUE ERROR",
`Error processing step ${currentStep} for ${x}:`,
error
);
sentry.captureException(error);
const currentRetries = this.stepRetries[currentStep] || 0;
const retryDelays = [
1 * 60 * 1000, // 1 minute
10 * 60 * 1000, // 10 minutes
60 * 60 * 1000, // 1 hour
4 * 60 * 60 * 1000, // 4 hours
24 * 60 * 60 * 1000, // 24 hours
];
if (currentRetries < retryDelays.length) {
this.stepRetries[currentStep] = currentRetries + 1;
const delay = retryDelays[currentRetries];
this.setAlarm(Date.now() + delay);
console.log(
`Retrying step ${currentStep} (attempt #${
this.stepRetries[currentStep]
}) for ${x} in ${delay / 1000 / 60} minutes`
);
} else {
console.error(
"x SKIPPING STEP",
`Step ${currentStep} failed ${retryDelays.length} times, skipping and moving to next step`
);
this.stepRetries[currentStep] = 0;
this.step = currentStep + 1;
this.setAlarm(Date.now());
}
await this.persist();
}
try {
//
} catch (error) {
console.error(
"x QUEUE ERROR",
`Error processing step ${currentStep} for ${x}:`,
error
);
sentry.captureException(error);
const currentRetries = this.stepRetries[currentStep] || 0;
const retryDelays = [
1 * 60 * 1000, // 1 minute
10 * 60 * 1000, // 10 minutes
60 * 60 * 1000, // 1 hour
4 * 60 * 60 * 1000, // 4 hours
24 * 60 * 60 * 1000, // 24 hours
];
if (currentRetries < retryDelays.length) {
this.stepRetries[currentStep] = currentRetries + 1;
const delay = retryDelays[currentRetries];
this.setAlarm(Date.now() + delay);
console.log(
`Retrying step ${currentStep} (attempt #${
this.stepRetries[currentStep]
}) for ${x} in ${delay / 1000 / 60} minutes`
);
} else {
console.error(
"x SKIPPING STEP",
`Step ${currentStep} failed ${retryDelays.length} times, skipping and moving to next step`
);
this.stepRetries[currentStep] = 0;
this.step = currentStep + 1;
this.setAlarm(Date.now());
}
await this.persist();
}