waitUntil
ThewaitUntil function extends the life of the isolate running a request. Use
it when a script needs to keep working after the request it answered has
finished. Even when no other requests are routed to the script, the invocation
stays alive.
It is useful for holding WebSocket connections open, refreshing
a cache entry in the background, or firing off telemetry once the response has
gone back to the client.
Signature
Parameters
Promise<unknown>
required
A promise representing background work. The isolate will stay alive until
this promise settles (resolves or rejects).
Returns
void. waitUntil does not return a value.
You can call
waitUntil multiple times; the script will only be evicted once
every given promise has been resolved.