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: 6 additions & 0 deletions src/content/docs/durable-objects/api/alarms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Alarms can be used to build distributed primitives, like queues or batching of w
- Set the time for the alarm to run. Specify the time as the number of milliseconds elapsed since the UNIX epoch.
- If you call `setAlarm` when there is already one scheduled, it will override the existing alarm.

:::caution[Calling `setAlarm` inside the constructor]
If you wish to call `setAlarm` inside the constructor of a Durable Object, ensure that you are first checking whether an alarm has already been set.

This is due to the fact that, if the Durable Object wakes up after being inactive, the constructor is invoked before the [`alarm` handler](/durable-objects/api/alarms/#alarm). Therefore, if the constructor calls `setAlarm`, it could interfere with the next alarm which has already been set.
:::

### `deleteAlarm`

- `deleteAlarm()`: <Type text='void' />
Expand Down
Loading