Skip to content

Commit

Permalink
chore(processor): add delay when dequeuing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
TBonnin committed May 30, 2024
1 parent 8c85ed6 commit 3503468
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/orchestrator/lib/clients/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class OrchestratorProcessor {
const tasks = await this.orchestratorClient.dequeue({ groupKey: this.groupKey, limit: this.queue.available() * 2, waitForCompletion: true }); // fetch more than available to keep the queue full
if (tasks.isErr()) {
logger.error(`failed to dequeue tasks: ${stringifyError(tasks.error)}`);
await new Promise((resolve) => setTimeout(resolve, 1000)); // wait for a bit before retrying to avoid hammering the server in case of repetitive errors
continue;
}
for (const task of tasks.value) {
Expand Down

0 comments on commit 3503468

Please sign in to comment.