Skip to content

Commit 39579fa

Browse files
committed
Adding info on alarmInfo for DO.
1 parent a5db620 commit 39579fa

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ Alarms can be used to build distributed primitives, like queues or batching of w
5454

5555
### `alarm`
5656

57-
- `alarm()`: <Type text='void' />
57+
- <code>alarm(`alarmInfo`<Type text="Object"/>)</code>`: <Type text='void' />
5858

5959
- Called by the system when a scheduled alarm time is reached.
6060

61+
- The optional parameter `alarmInfo` object has two properties:
62+
- `retryCount` <Type text="number"/>: The maximum number of retries if the alarm does not wake up the Durable Object.
63+
- `isRetry` <Type text="boolean"/>: A boolean value to indicate if the alarm should be retried.
64+
6165
- The `alarm()` handler has guaranteed at-least-once execution and will be retried upon failure using exponential backoff, starting at 2 second delays for up to 6 retries. Retries will be performed if the method fails with an uncaught exception.
6266

6367
- This method can be `async`.

src/content/docs/durable-objects/api/base.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ export class MyDurableObject extends DurableObject {
3535

3636
### `alarm`
3737

38-
- <code>alarm()</code>: <Type text="Promise <void>"/>
38+
- <code>alarm(`alarmInfo`<Type text="Object"/>)</code>: <Type text="Promise <void>"/>
3939

4040
- Called by the system when a scheduled alarm time is reached.
4141

42+
- The optional parameter `alarmInfo` object has two properties:
43+
- `retryCount` <Type text="number"/>: The maximum number of retries if the alarm does not wake up the Durable Object.
44+
- `isRetry` <Type text="boolean"/>: A boolean value to indicate if the alarm should be retried.
45+
4246
- The `alarm()` handler has guaranteed at-least-once execution and will be retried upon failure using exponential backoff, starting at two second delays for up to six retries. Retries will be performed if the method fails with an uncaught exception.
4347

4448
- This method can be `async`.

0 commit comments

Comments
 (0)