hmm, it seems like my messages are being

hmm, it seems like my messages are being retried immediately after an implicit retry instead of waiting the configured 60 seconds..
[[env.staging.queues.consumers]]
queue = "emails-staging"
max_batch_size = 1
max_concurrency = 1
dead_letter_queue = "emails-dlq-staging"
max_retries = 5
retry_delay = 60
[[env.staging.queues.consumers]]
queue = "emails-staging"
max_batch_size = 1
max_concurrency = 1
dead_letter_queue = "emails-dlq-staging"
max_retries = 5
retry_delay = 60
3 Replies
johtso
johtsoOP12mo ago
id: 46ff84346aa373686c92055cc6259252 2024-09-05T15:02:09.183Z @Pranshu Maheshwari any chance of getting some eyes on this when you have a moment? 🙏 I'm relying on the queue configuration to stop me spamming my APIs if there are failures Retry delay seems to be ignored for some reason
Pranshu Maheshwari
hey, thanks for the ping, I totally missed this you probably checked this already, but just in case: when marking a message to be retried, you're not setting delaySeconds on the individual message right? also, is this happening locally or when you deploy your consumer? there's a known issue with local consumers & retry delays (which is expected to be fixed by next week)
Sid
Sid12mo ago
I was just looking into this, and can't seem to repro during local dev or after deployment, interestingly My Worker is really simple:
type Env = {
Q: Queue<string>;
};

export default {
async fetch(request: Request, env: Env) {
console.log("Pushing to queue");
await env.Q.send("1");
return new Response("1");
},

async queue(messages: MessageBatch) {
console.log(`[${Date.now()}] Processing`, JSON.stringify(messages));
messages.retryAll();
},
} satisfies ExportedHandler<Env>;
type Env = {
Q: Queue<string>;
};

export default {
async fetch(request: Request, env: Env) {
console.log("Pushing to queue");
await env.Q.send("1");
return new Response("1");
},

async queue(messages: MessageBatch) {
console.log(`[${Date.now()}] Processing`, JSON.stringify(messages));
messages.retryAll();
},
} satisfies ExportedHandler<Env>;
wrangler.toml:
[[queues.producers]]
queue = "playground"
binding = "Q"

[[queues.consumers]]
queue = "playground"
max_retries = 5
retry_delay = 5
[[queues.producers]]
queue = "playground"
binding = "Q"

[[queues.consumers]]
queue = "playground"
max_retries = 5
retry_delay = 5
Can you try logging the message.attempts to make sure you don't have similar-looking messages? Also message.timestamp might also help Tried individual message.retrys as well, that also seems to work as expected

Did you find this page helpful?