feat: update delayed task processing to a shared 9-hour maximum delay, remove invalid KV entries

This commit is contained in:
2025-12-17 06:35:57 -05:00
parent 05df043fbe
commit 6eb42f6a33
2 changed files with 13 additions and 14 deletions

View File

@@ -30,6 +30,10 @@ interface QueueTaskOptionalArgs {
env?: Cloudflare.Env;
}
export const MAX_DELAY_SECONDS = Duration.fromObject({ hours: 9 }).as(
"seconds",
);
export async function queueTask(
queueName: QueueName,
body: QueueBody[QueueName],
@@ -42,8 +46,6 @@ export async function queueTask(
req?.header(),
);
const MAX_DELAY_SECONDS = Duration.fromObject({ hours: 9 }).as("seconds");
// If delay exceeds 9 hours, store in KV for later processing
if (scheduleTime > MAX_DELAY_SECONDS) {
if (!env || !env.DELAYED_TASKS) {