-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
Milestone
Description
If we fire two std.read
, jk
will currently start two goroutines and the first goroutine to finish will signal the promise as resolved. It means promise resolve functions can be called in any order.
In turns, it opens many non-deterministic behaviour if the promise resolve functions act on a global state: mutate global or captured variables, call the random generator, ...
One possible way to make this a lot better is to resolve the promise in the order they came in. Ensuring the resolve functions are always called in the same order. This depends a bit on the v8 internals and on what happens when a promise is resolved. Need a bit more digging (and a test!)