waitUntil multiple
What happens when I waitUntil multiple promises? Is this safe? What's the execution order?
8 Replies
waitUntil
doesn't actually affect execution order, it just flags the runtime to tell it "don't shut down until this promise resolves".
Basically, promises will be executed in the order they are created, irrespective of when they are put through waitUntil
.order they are createdwait what? I was under the impression that promises only start to be executed once you await them? (or a derived one)
No. For example, in the browser, you can
fetch
a resource, and the fetch
may complete, but you can never know that it completed until you await
it.oooh. Well that's unfortunate. Thanks
WDYM?
Well I was hoping that shuffling an array of promises would make them also execute in random order
You could shuffle the system that builds the promises?
yes, I'm doing that now, but that's a lot more work :/
but thanks for the info :)