machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 157 forks source link

Avoid applying states out of order #423

Closed maxfierke closed 3 years ago

maxfierke commented 3 years ago

Covered by the included test case based on #422.

Given a bounded scheduler policy that drops running task instances, if there's an immediate return in via a later perform call, the state update from the earlier task instance may get applied later than the task instance with the immediate return.

Applied a similar approach that Glimmer uses, which is an incrementing tag, by which we will track which state updates are still valid. Anything after the last applied tag will be valid and state updates from before will be ignored.