Closed dtex closed 6 years ago
Storing last in a global and updating anytime task.later is greater seems to solve the problem. I'll do some performance testing on that option.
Here's all the dirt on this issue.
https://github.com/tc39/ecma262/pull/1242
In short, implementations don't match the spec.
I wanted to submit this before submitting the HR pull request to avoid confusion.
When using
Object.keys()
to populate thescheduled
array inprocessQueue()
we can't trust that V8 will return an array that is sorted by key. Since temporal checks the last member of that array to see if there is anything left in the queue that needs to be run, temporal checks the last member added, not the last member by the scheduled time to execute.In other words, Temporal assumes that tasks are added in the order that they are expected to execute.
For example, this works:
But this does not:
Here's the offending code: