Skip to content

Commit 9ea09b7

Browse files
authored
Adding suggested fix to clarify example code behaviour. (#19759)
1 parent 8004051 commit 9ea09b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/content/docs/durable-objects/examples/alarms-api.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ description: Use the Durable Objects Alarms API to batch requests to a Durable O
1515

1616
import { GlossaryTooltip, WranglerConfig } from "~/components";
1717

18-
This example implements an <GlossaryTooltip term="alarm">`alarm()`</GlossaryTooltip> handler that wakes the Durable Object once every 10 seconds to batch requests to a single Durable Object. The `alarm()` handler will delay processing until there is enough work in the queue.
18+
This example implements an <GlossaryTooltip term="alarm">`alarm()`</GlossaryTooltip> handler that allows batching of requests to a single Durable Object.
19+
20+
When a request is received and no alarm is set, it sets an alarm for 10 seconds in the future. The `alarm()` handler processes all requests received within that 10-second window.
21+
22+
If no new requests are received, no further alarms will be set until the next request arrives.
1923

2024
```js
2125
import { DurableObject } from 'cloudflare:workers';

0 commit comments

Comments
 (0)