waitUntil

i am using sveltekit and deploying to Cloudflare Pages. In a Pages Function, I am curious what happens if I don't await an async operation and return to the user. For instance, I have an endpoint which deletes images from Cloudflare Images, but I'd rather not make the user wait for that to happen, so I simply don't await the Promise.all that calls the Cloudflare API. It seems to be working great, but is this problematic?
2 Replies
jason
jason4mo ago
Cloudflare has a special method called waitUntil (iirc) where you can put an asynchronous function and then return a response to the user. The response will be immediate but the function will stay active until your waitUntil item is done.
Paul
PaulOP4mo ago
oh thats perfect Weird that it was working before without it, but this seems more explicit. Thanks!
Want results from more Discord servers?
Add your server