-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(schedulers): fix asap and animationFrame schedulers to execute across their respective async boundaries #1820
Conversation
b934493
to
61a6e83
Compare
61a6e83
to
62aa0d2
Compare
* ``` | ||
* | ||
* @class Scheduler | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anyone else reviewing this PR: JSDoc in this file looks correct and should render correctly on the site. 👍
LGTM (as long as we correct the one docs issue @staltz pointed out) |
@Blesh what's the issue? |
@@ -184,6 +184,8 @@ import observable from 'symbol-observable'; | |||
* asynchronous conversions. | |||
* @property {Scheduler} async Schedules work with `setInterval`. Use this for | |||
* time-based operations. | |||
* @property {Scheduler} animation Schedules work with `requestAnimationFrame`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this animation
be animationFrame
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yup @trxcllnt this needs fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Blesh ok, I'll update. Though I was thinking Scheduler.animation
vs. Scheduler.animationFrame
would be a nice alias.
Looks like this needs a rebase, @trxcllnt I'd like to get it merged. |
62aa0d2
to
1bd2902
Compare
@Blesh rebased |
* according to the `delay` parameter, if specified. | ||
* @param {any} [state] Some contextual data that the `work` function uses when | ||
* called by the Scheduler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this {any}
jsdoc correct? Should it be {T}
with @template T
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saneyuki I think you're right. I'll update the PR.
…ross async boundaries. The AsapScheduler and AnimationFrameSchedulers were totally busted. My bad. Now they execute their scheduled actions in batches. If actions reschedule while executing a batch, a new frame is requested for the rescheduled action to execute in. This PR also simplifies the public `Scheduler` and `Action` APIs. Implementation details like the `actions` queue and `active` boolean are now on the concrete implementations, so it's easier for people to implement the Scheduler API. This PR also renames `FutureAction` -> `AsyncAction` to conform to the same naming convention as the rest of the Action types. Fixes ReactiveX#1814
1bd2902
to
8968293
Compare
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
The AsapScheduler and AnimationFrameScheduler were totally busted. My bad. Now they execute their scheduled actions in batches. If actions reschedule while executing a batch, a new frame is requested for the rescheduled action to execute in.
Other updates included in this PR:
Scheduler
andAction
APIs. Implementation details like theactions
queue andactive
boolean are now on the concrete implementations, so it's easier for people to implement the Scheduler API.FutureAction
->AsyncAction
to conform to the same naming convention as the rest of the Action types.QueueAction
should be able to reschedule with delay > 0 and fall back to its parent class's (AsyncAction
) behavior.Related issue (if exists):
Fixes #1814
Performance results:
Re-ran a few of the performance tests to check regressions when using the queue scheduler. No discernible perf hits.
Current master:
This PR:
Side-by-side: