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
By default, Durable Objects delay applying Worker code deployments so in-flight requests can finish. Instead of resetting an active Durable Object immediately to apply a code update, Cloudflare applies the code update once the object is inactive (is hibernated).
21
21
22
-
Deploy a Worker with `durable-objects-code-update-strategy` set to `immediate` to apply a code update right away instead of waiting. Refer to [Lifecycle of a Durable Object](/durable-objects/concepts/durable-object-lifecycle/) for more on when an object hibernates.
22
+
Deploy a Worker with `--durable-objects-code-update-mode immediate` to apply a code update right away instead of waiting. Refer to [Lifecycle of a Durable Object](/durable-objects/concepts/durable-object-lifecycle/) for more on when an object hibernates.
23
23
24
24
## Code update strategy
25
25
@@ -67,7 +67,9 @@ This means an `immediate` deploy always forces the update right away, even while
67
67
68
68
Configure `code_update_strategy` as a persistent default in your Wrangler configuration, or override it for a single deployment using the CLI flag or the REST API.
69
69
70
-
`code_update_strategy` applies to every Durable Object class this Worker exports — you can't set a different strategy for one class than another in the same deployment. This includes classes exported through [`ctx.exports`](/workers/runtime-apis/context/#exports) without an explicit `bindings` entry. If a binding uses `script_name` to reference a class defined in a different Worker, that class's code updates are controlled by that other Worker's own `code_update_strategy`, not this one.
70
+
`code_update_strategy` applies to every Durable Object class this Worker exports — you can't set a different strategy for one class than another in the same Worker. This includes classes exported through [`ctx.exports`](/workers/runtime-apis/context/#exports) without an explicit `bindings` entry.
71
+
72
+
If a Durable Objects binding uses `script_name` to reference a class defined in a different Worker, that class's code updates are controlled by that other Worker's own `code_update_strategy`, not the Worker with the binding.
71
73
72
74
### Options
73
75
@@ -79,9 +81,9 @@ Configure `code_update_strategy` as a persistent default in your Wrangler config
79
81
|`{ "mode": "deferred", "max_delay": 0 }`| Valid, but Cloudflare waits zero seconds — behaves identically to `immediate`. |
80
82
|`{ "mode": "deferred", "max_delay": 120 }`| Cloudflare waits up to 120 seconds for the object to hibernate before applying the update. |
81
83
|`{ "mode": "immediate" }`| Cloudflare applies the update immediately, without waiting for the object to hibernate. |
82
-
|`{ "mode": "immediate", "max_delay": 60 }`|**Invalid.**Wrangler and the REST API reject this configuration — `max_delay`has no effect when`mode` is `immediate`. |
Add `code_update_strategy` alongside `bindings` in the `durable_objects` object of your [Wrangler configuration file](/workers/wrangler/configuration/#durable-objects):
0 commit comments