Dynamic og#19
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b9f5ec35d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } satisfies OGStatus), | ||
| ); | ||
|
|
||
| message.ack() |
There was a problem hiding this comment.
Let failed queue jobs retry instead of acknowledging them
Do not call ack() in the error path: this unconditionally deletes messages even when OG generation fails, so transient failures (Browser Rendering API, R2, DO RPC) are never retried and never reach the configured DLQ. With this consumer config (wrangler.og-consumer.json sets dead_letter_queue), failed deliveries should be left unacked/errored so the queue can apply retry/DLQ semantics.
Useful? React with 👍 / 👎.
| await Promise.all([ | ||
| env.OG_STATUS.put( | ||
| `og:${id}`, | ||
| JSON.stringify({ | ||
| status: "pending", | ||
| createdAt: now, | ||
| updatedAt: now, | ||
| attempts: 0, | ||
| } satisfies OGStatus), | ||
| ), | ||
| env.OG_QUEUE.send({ id } satisfies OGQueueMessage), |
There was a problem hiding this comment.
Avoid writing pending status before queue enqueue is confirmed
This Promise.all performs OG_STATUS.put(...pending...) in parallel with OG_QUEUE.send(...); if send() throws (for example due queue throughput/backlog errors), the status can remain stuck as pending even though no message was queued. This creates incorrect job state and consumes a reserved budget slot without any consumer run.
Useful? React with 👍 / 👎.
No description provided.