Skip to content

Commit

Permalink
fix(delay): fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ubnt-michals committed May 3, 2018
1 parent 60e7521 commit 8afb492
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/operators/delay-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Observable, timer } from 'rxjs';
import { delay, repeatWhen, skip, take, tap, finalize } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { delay, repeatWhen, skip, take, tap } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import * as sinon from 'sinon';
import { expect } from 'chai';
Expand Down Expand Up @@ -147,12 +147,12 @@ describe('Observable.prototype.delay', () => {
expectObservable(result).toBe(expected);
});

it('should unsubscribe scheduled action when result is unsubscribed explicitly', () => {
it('should unsubscribe scheduled actions after execution', () => {
let subscribeSpy: any = null;
const counts: number[] = [];

const e1 = cold('a|');
const expected = '--a-(a|)';
const expected = '--a-(a|)';
const duration = time('-|');
const result = e1.pipe(
repeatWhen(notifications => {
Expand Down
1 change: 1 addition & 0 deletions src/internal/operators/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class DelaySubscriber<T> extends Subscriber<T> {
const delay = Math.max(0, queue[0].time - scheduler.now());
this.schedule(state, delay);
} else {
this.unsubscribe();
source.active = false;
}
}
Expand Down

0 comments on commit 8afb492

Please sign in to comment.