Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/content/docs/durable-objects/examples/alarms-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ description: Use the Durable Objects Alarms API to batch requests to a Durable O

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

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.
This example implements an <GlossaryTooltip term="alarm">`alarm()`</GlossaryTooltip> handler that allows batching of requests to a single Durable Object.

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.

If no new requests are received, no further alarms will be set until the next request arrives.

```js
import { DurableObject } from 'cloudflare:workers';
Expand Down