fix: animationFrameScheduler and asapScheduler no longer executing actions#6889
Open
ajafff wants to merge 1 commit intoReactiveX:masterfrom
Open
fix: animationFrameScheduler and asapScheduler no longer executing actions#6889ajafff wants to merge 1 commit intoReactiveX:masterfrom
ajafff wants to merge 1 commit intoReactiveX:masterfrom
Conversation
This was referenced Mar 14, 2022
benlesh
requested changes
Mar 28, 2022
| result.push('work'); | ||
| if (reschedule) { | ||
| asapScheduler.schedule(() => result.push('task 1')); | ||
| asapScheduler.schedule(() => result.push('task 2')); |
Member
There was a problem hiding this comment.
Can we add an assertion right here to make sure that the above tasks didn't execute synchronously in this spot? Basically, just check to make sure results haven't changed yet. It's not so much that I think they did, it's that I want to make sure they're "scheduled" and don't just happen to mimic the proper outcome by virtue of when we checked.
Please do the same for the other test? Thanks, @ajafff!
Otherwise, this looks great.
There was a problem hiding this comment.
@benlesh could you please review it again? Can't upgrade above 7.4.0 due to this problem.
4319c90 to
ad36f57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
AnimationFrameActionandAsapAction'srecycleAsyncIdshould only resetscheduler_scheduledif it's the sameidwe are currently recycling. This fixes the issue described in #6854 where actions scheduled from another action have already setscheduler._scheduled, which is then cleared when the currently executing action is done.This works because there are at most 2 schedules for these schedulers: the currently executing one and the next schedule. This also means we no longer
cancelAnimationFrame/clearImmediatethe current schedule after its last action is done (which does nothing for correctness, but avoid unnecessary work).Related issue (if exists):
Fixes #6854