Skip to content

Commit

Permalink
fix(groupBy): unsubscribe GroupDurationSubscriber after completing th…
Browse files Browse the repository at this point in the history
…e group

The Groups are disposed by the GroupDurationSelector, however the
GroupDurationSubscriber can be subscribed to a different observable
than the group itself. To prevent any unwanted subscriptions to
accumulate over time we need to explicitly unsubscribe after the
first event in GroupDurationSubscriber closes the group.

Fixes ReactiveX#2660
  • Loading branch information
hermanbanken committed Jun 13, 2017
1 parent 4bd3ea2 commit 1a03cc2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/operator/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class GroupDurationSubscriber<K, T> extends Subscriber<T> {
group.error(err);
}
this.parent.removeGroup(this.key);
this.unsubscribe();
}

protected _complete(): void {
Expand All @@ -248,6 +249,7 @@ class GroupDurationSubscriber<K, T> extends Subscriber<T> {
group.complete();
}
this.parent.removeGroup(this.key);
this.unsubscribe();
}
}

Expand Down

0 comments on commit 1a03cc2

Please sign in to comment.