waitUntil multiple

What happens when I waitUntil multiple promises? Is this safe? What's the execution order?
8 Replies
Hello, I’m Allie!
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.
Kai
KaiOP2y ago
order they are created
wait what? I was under the impression that promises only start to be executed once you await them? (or a derived one)
Hello, I’m Allie!
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.
Kai
KaiOP2y ago
oooh. Well that's unfortunate. Thanks
Hello, I’m Allie!
WDYM?
Kai
KaiOP2y ago
Well I was hoping that shuffling an array of promises would make them also execute in random order
Hello, I’m Allie!
You could shuffle the system that builds the promises?
Kai
KaiOP2y ago
yes, I'm doing that now, but that's a lot more work :/ but thanks for the info :)
Want results from more Discord servers?
Add your server