feat: update delayed task processing to a shared 9-hour maximum delay, remove invalid KV entries
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user