feat: Increase maximum direct queue delay from 9 to 12 hours and cap retry delays at this new limit.
This commit is contained in:
18
src/index.ts
18
src/index.ts
@@ -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,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user