diff --git a/docs/manual/deploy.md b/docs/manual/deploy.md index a46afc7a8..ffa1d152d 100644 --- a/docs/manual/deploy.md +++ b/docs/manual/deploy.md @@ -927,6 +927,14 @@ does not. See the [*`WorkersD1KvStore`*](./kv.md#workersd1kvstore-cloudflare-workers-only) section for details. +> [!WARNING] +> Do not use `InProcessMessageQueue` on Cloudflare Workers. A delayed +> enqueue depends on `setTimeout()`, which may never run after the isolate +> exits, and `listen()` polls memory that is not guaranteed to survive or +> be shared across requests. Use `WorkersMessageQueue` and a `queue()` +> handler, as shown in [Manual queue processing](#manual-queue-processing), +> or configure another durable queue. + #### Node.js compatibility Fedify depends on Node.js APIs for cryptography and DNS, so Workers need diff --git a/docs/manual/mq.md b/docs/manual/mq.md index 1a6498fda..b75dd22bf 100644 --- a/docs/manual/mq.md +++ b/docs/manual/mq.md @@ -44,6 +44,17 @@ Cons : Not suitable for production, doesn't persist messages between restarts, no native retry mechanism. +> [!WARNING] +> `InProcessMessageQueue` cannot run on [Cloudflare Workers]. A delayed +> `enqueue()` schedules a `setTimeout()` and resolves immediately, but a +> Worker isolate can terminate after the response, so the timer may never +> run and the message may never enter the queue. `listen()` only polls +> in-memory state, which is not guaranteed to survive or be shared across +> requests. Use +> [`WorkersMessageQueue`](#workersmessagequeue-cloudflare-workers-only) with +> a `queue()` handler, or another durable queue. Do not treat a delayed +> enqueue as reliable on Workers. + ~~~~ typescript twoslash import type { KvStore } from "@fedify/fedify"; // ---cut-before---