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
Kai17mo 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
Kai17mo ago
oooh. Well that's unfortunate. Thanks
Hello, I’m Allie!
WDYM?
Kai
Kai17mo 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
Kai17mo ago
yes, I'm doing that now, but that's a lot more work :/ but thanks for the info :)