Queues taking 25 seconds to be consumed in development. Why?

In local development, when I have an api route that triggers a queue using hono, and the consumer simply console logs the message, for some reason it has a delay of 25 seconds before all the console logs come printing out. Any idea on why that is? I would have thought it would be instant...? Code is written with hono.js This is my producer:
app.get("/test", async c => {
const message = `Test message. Random number: ${Math.floor(Math.random() * 100)}`;
await c.env.WEBSITE_QUEUE.send({
body: message,
});

return c.json({ success: `Queued up this message: ${message}` });
});
app.get("/test", async c => {
const message = `Test message. Random number: ${Math.floor(Math.random() * 100)}`;
await c.env.WEBSITE_QUEUE.send({
body: message,
});

return c.json({ success: `Queued up this message: ${message}` });
});
This is my consumer that simply console.logs the message
export default {
fetch: app.fetch,
async queue(batch: MessageBatch<{ body: string }>, env: Environment) {
for (const message of batch.messages) {
console.log(
`Consuming message: ${JSON.stringify(message.body, null, 2)}`
);
}
},
};
export default {
fetch: app.fetch,
async queue(batch: MessageBatch<{ body: string }>, env: Environment) {
for (const message of batch.messages) {
console.log(
`Consuming message: ${JSON.stringify(message.body, null, 2)}`
);
}
},
};
1 Reply
Paul
PaulOP7mo ago
Nevermind, I figured it out. It's the max batch timeout settings in the toml file.
Want results from more Discord servers?
Add your server