feat: Increase maximum direct queue delay from 9 to 12 hours and cap retry delays at this new limit.

This commit is contained in:
2025-12-17 09:44:30 -05:00
parent 6570c25617
commit dc60a1e045
5 changed files with 27 additions and 19 deletions

View File

@@ -7,7 +7,10 @@ import { maybeUpdateLastConnectedAt } from "~/controllers/maybeUpdateLastConnect
import { AnilistUpdateType } from "~/libs/anilist/updateType";
import { calculateExponentialBackoff } from "~/libs/calculateExponentialBackoff";
import type { QueueName } from "~/libs/tasks/queueName.ts";
import type { QueueBody } from "~/libs/tasks/queueTask";
import {
MAX_QUEUE_DELAY_SECONDS,
type QueueBody,
} from "~/libs/tasks/queueTask";
export const app = new OpenAPIHono<{ Bindings: Env }>();
@@ -146,11 +149,14 @@ function onMessageQueue<QN extends QueueName>(
);
console.error(error);
message.retry({
delaySeconds: calculateExponentialBackoff({
attempt: message.attempts,
baseMin: retryDelayConfig[messageBatch.queue as QN]?.min,
absCap: retryDelayConfig[messageBatch.queue as QN]?.max,
}),
delaySeconds: Math.min(
calculateExponentialBackoff({
attempt: message.attempts,
baseMin: retryDelayConfig[messageBatch.queue as QN]?.min,
absCap: retryDelayConfig[messageBatch.queue as QN]?.max,
}),
MAX_QUEUE_DELAY_SECONDS,
),
});
}
}