Skip to content

Commit 1b59a25

Browse files
committed
docs(rivetkit): clean up stale setPreventSleep references in docs and JSDoc
1 parent 3d62102 commit 1b59a25

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

rivetkit-typescript/packages/rivetkit/src/actor/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ const InstanceActorOptionsBaseSchema = z
884884
.default(DEFAULT_WAIT_UNTIL_TIMEOUT),
885885
connectionLivenessTimeout: z.number().positive().default(2500),
886886
connectionLivenessInterval: z.number().positive().default(5000),
887-
/** @deprecated Use `c.setPreventSleep(true)` for bounded delays or keep `noSleep` for actors that must stay awake indefinitely. Will be removed in 2.2.0. */
887+
/** @deprecated Use `c.keepAwake(promise)` to scope keep-awake to a specific operation, or keep `noSleep` for actors that must stay awake indefinitely. Will be removed in 2.2.0. */
888888
noSleep: z.boolean().default(false),
889889
sleepTimeout: z.number().positive().default(30_000),
890890
maxQueueSize: z.number().positive().default(1000),
@@ -1808,7 +1808,7 @@ export const DocActorOptionsSchema = z
18081808
.boolean()
18091809
.optional()
18101810
.describe(
1811-
"Deprecated. If true, the actor will never sleep. Use c.setPreventSleep(true) for bounded idle sleep delays instead. Default: false",
1811+
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false",
18121812
),
18131813
sleepTimeout: z
18141814
.number()

rivetkit-typescript/packages/rivetkit/src/workflow/context.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,10 @@ export class ActorWorkflowContext<
545545
}
546546

547547
/**
548-
* @deprecated Use `onSleep` for shutdown or flush work, or
549-
* `c.setPreventSleep(true)` while work is active if the actor must stay
550-
* awake until it finishes.
548+
* Registers a promise that the sleep grace period will wait on. Use this
549+
* for best-effort flush/cleanup work that may complete inside the grace
550+
* window. For work the actor must stay running through, prefer
551+
* `c.keepAwake(promise)` which also blocks idle sleep.
551552
*/
552553
waitUntil(promise: Promise<void>): void {
553554
this.#ensureActorAccess("waitUntil");

website/src/content/docs/actors/limits.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ See [Actor Input](/docs/actors/input) for details.
128128
| Create vars timeout | 5 seconds || Timeout for `createVars` hook. Configurable via `createVarsTimeout`. |
129129
| Create conn state timeout | 5 seconds || Timeout for `createConnState` hook. Configurable via `createConnStateTimeout`. |
130130
| On connect timeout | 5 seconds || Timeout for `onConnect` hook. Configurable via `onConnectTimeout`. |
131-
| Sleep grace period | 15 seconds || Total graceful sleep budget for `onSleep`, `waitUntil`, async raw WebSocket handlers, and waiting for `preventSleep` to clear after shutdown starts. |
131+
| Sleep grace period | 15 seconds || Total graceful sleep budget for `onSleep`, `waitUntil`, `keepAwake`, and async raw WebSocket handlers. |
132132
| On destroy timeout | 15 seconds || Total graceful destroy budget for `onDestroy`, run handler shutdown, and connection cleanup. Configurable via `onDestroyTimeout`. |
133133
| Sleep timeout | 30 seconds || Time of inactivity before actor hibernates. Configurable via `sleepTimeout`. |
134134
| State save interval | 10 seconds || Interval between automatic state saves. Configurable via `stateSaveInterval`. |

website/src/content/docs/actors/versions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Several timeouts control how long each part of the shutdown process can take:
357357
| Timeout | Default | Description | Configuration |
358358
|---------|---------|-------------|---------------|
359359
| `actor_stop_threshold` | 30s | Engine-side limit on how long each actor has to stop before being marked lost | [Engine config](/docs/self-hosting/configuration) (`pegboard.actor_stop_threshold`) |
360-
| `sleepGracePeriod` | 15s | Total graceful sleep budget for `onSleep`, `waitUntil`, async raw WebSocket handlers, and waiting for `preventSleep` to clear after shutdown starts | [Actor options](/docs/actors/lifecycle#options) |
360+
| `sleepGracePeriod` | 15s | Total graceful sleep budget for `onSleep`, `waitUntil`, `keepAwake`, and async raw WebSocket handlers | [Actor options](/docs/actors/lifecycle#options) |
361361
| `runner_lost_threshold` | 15s | Fallback detection if the runner dies without graceful shutdown | [Engine config](/docs/self-hosting/configuration) (`pegboard.runner_lost_threshold`) |
362362

363363
Rivet has a max shutdown grace period of 30 minutes that cannot be configured.

website/src/content/docs/general/architecture.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ actors have create, destroy, wake, and sleep lifecycle hooks that you can implem
7272
- actors sleep when not in use
7373
- an actor is considered not in use when there are no active network connections to the actor (or the network connections are hibernatable websockets, see below) and there are no actions in flight
7474
- actors have a sleep timeout (configured in `options.sleepTimeout`) that decides how long to keep the actor in memory with no recent activity
75-
- sleep can be delayed while idle with `c.setPreventSleep(true)`
75+
- sleep can be held off for the lifetime of a promise with `c.keepAwake(promise)`
7676
- see the [sleeping docs](/docs/actors/lifecycle#sleeping) for full details
7777

7878
### wake events

0 commit comments

Comments
 (0)