Workers duration limit confusion

Use event.waitUntil() to delay cancellation for another 30 seconds or until the promise passed to waitUntil() completes.
The docs on Duration Limit (https://developers.cloudflare.com/workers/platform/limits/#duration) says that using waitUntil() delays Worker expiration untils 30 secs *or * the promise completes. The "or" is confusing me. Does that mean it'll continue for the longer of the two (and potentially indefinitely while awaiting the Promise)?
1 Reply
Chaika
Chaika4mo ago
30s max The explaination here is perhaps a bit better: https://developers.cloudflare.com/workers/platform/limits/#how-long-can-a-subrequest-take
When the client disconnects, all tasks associated with that client’s request are proactively canceled. If the Worker passed a promise to event.waitUntil(), cancellation will be delayed until the promise has completed or until an additional 30 seconds have elapsed, whichever happens first.

Did you find this page helpful?