Can you call context.waitUntil() multiple times?

After handling a request, I have to save something to KV and make a fetch call to some other service. The order in which they execute does not matter.

My code looks like this

async function handler(request, env, context) {
  /// generate response...

  context.waitUntil(saveResultToKV(stuff, env))
  context.waitUntil(callExternalService(env))

  return response;
}


Will the runtime wait for all the promises passed to context.waitUntil?
Or will the runtime stop when the first promise resolves?
Was this page helpful?