Skip to content

Commit

Permalink
fix(scheduler): prevent unwanted clearInterval
Browse files Browse the repository at this point in the history
In AsyncAction, this.pending was assigned before the call to
recycleAsyncId. That prevented the interval from being re-used resulting
in the interval being cleared and re-created for each notification.

Closes ReactiveX#3042
  • Loading branch information
cartant committed Nov 4, 2017
1 parent cff9dfa commit 5fd3ac6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scheduler/AsyncAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export class AsyncAction<T> extends Action<T> {
// Always replace the current state with the new state.
this.state = state;

// Set the pending flag indicating that this action has been scheduled, or
// has recursively rescheduled itself.
this.pending = true;

const id = this.id;
const scheduler = this.scheduler;

Expand Down Expand Up @@ -61,6 +57,10 @@ export class AsyncAction<T> extends Action<T> {
this.id = this.recycleAsyncId(scheduler, id, delay);
}

// Set the pending flag indicating that this action has been scheduled, or
// has recursively rescheduled itself.
this.pending = true;

this.delay = delay;
// If this action has already an async Id, don't request a new one.
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
Expand Down

0 comments on commit 5fd3ac6

Please sign in to comment.