You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-internal/engine/rivetkit-core-internals.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Two-phase:
85
85
-`SleepGrace` fires `onSleep` immediately and keeps dispatch/save timers live.
86
86
-`SleepFinalize` gates dispatch, suspends alarms, and runs teardown.
87
87
88
-
Sleep grace must fire the actor abort signal on entry and wait for the run handler to exit before finalize. Destroy abort firing remains unchanged.
88
+
Sleep grace waits for the run handler to exit before finalize. The actor abort signal fires once when final shutdown completes, not when sleep grace or destroy starts.
Copy file name to clipboardExpand all lines: docs-internal/engine/sleep-sequence.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,9 @@ Removing `preventSleep` deleted both predicate branches. Any future sleep-affect
37
37
38
38
## Grace period and abort signals
39
39
40
-
-`start_grace(reason)` fires at the start of `SleepGrace` / `DestroyGrace`. It cancels the sleep idle timer, cancels the actor abort signal (`actor_abort_signal`), installs a `SleepGraceState` with the effective grace deadline, and resets the sleep timer to arm the grace tick.
41
-
- The actor abort signal is a soft signal: "shutdown has started, please wrap up." User code observes it via `c.abortSignal`. It does not force-stop work.
42
-
-For destroy, the abort signal may fire earlier than grace entry because`ctx.destroy()`cancels the abort token immediately via `mark_destroy_requested(...)`.
40
+
-`start_grace(reason)` fires at the start of `SleepGrace` / `DestroyGrace`. It cancels the sleep idle timer, installs a `SleepGraceState` with the effective grace deadline, and resets the sleep timer to arm the grace tick.
41
+
- The actor abort signal is a finalization signal. User code observes it via `c.abortSignal`, and it fires once after shutdown work has finished or the grace deadline has forced finalization.
42
+
-Destroy does not fire the actor abort signal early.`ctx.destroy()`only records the destroy request and starts the same final shutdown path.
* The handler receives an abort signal via `c.abortSignal` and a
1230
-
* `c.aborted` alias for loop checks. Use these to gracefully exit.
1230
+
* `c.aborted` alias. The signal fires once when actor shutdown finalizes.
1231
1231
*
1232
1232
* If this handler exits, the actor will follow the normal idle sleep timeout
1233
1233
* once it becomes idle.
@@ -1770,7 +1770,7 @@ export const DocActorOptionsSchema = z
1770
1770
.number()
1771
1771
.optional()
1772
1772
.describe(
1773
-
`Max time in ms for the graceful shutdown window. Covers lifecycle hooks (onSleep, onDestroy), the run handler abort wait, async raw WebSocket handlers, disconnect callbacks, and final state serialization. Default: ${DEFAULT_SLEEP_GRACE_PERIOD}.`,
1773
+
`Max time in ms for the graceful shutdown window. Covers lifecycle hooks (onSleep, onDestroy), the run handler wait, async raw WebSocket handlers, disconnect callbacks, and final state serialization. Default: ${DEFAULT_SLEEP_GRACE_PERIOD}.`,
Copy file name to clipboardExpand all lines: website/src/content/docs/actors/actions.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,7 +325,7 @@ Actions have a single return value. To stream realtime data in response to an ac
325
325
326
326
## Canceling Long-Running Actions
327
327
328
-
For operations that should be cancelable on-demand, create your own `AbortController` and chain it with `c.abortSignal` for automatic cleanup on actor shutdown.
328
+
For operations that should be cancelable on-demand, create your own `AbortController`. Chain it with `c.abortSignal`only for final actor shutdown cleanup.
Copy file name to clipboardExpand all lines: website/src/content/docs/actors/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -466,7 +466,7 @@ const userAccount = actor({
466
466
467
467
### Lifecycle Hooks
468
468
469
-
Actors support hooks for initialization, background processing, connections, networking, and state changes. Use `run` for long-lived background loops, and exit cleanly on shutdown with `c.aborted` or `c.abortSignal`.
469
+
Actors support hooks for initialization, background processing, connections, networking, and state changes. Use `run` for long-lived background loops, and use `c.aborted` or `c.abortSignal` for final shutdown cleanup.
0 commit comments