Skip to content

Commit

Permalink
fix(windowTime): clean up closed window with timeSpanOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jan 14, 2017
1 parent dd925a8 commit b6f6ed4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/operator/windowTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class WindowTimeSubscriber<T> extends Subscriber<T> {
private windowCreationInterval: number,
private scheduler: IScheduler) {
super(destination);

const window = this.openWindow();
if (windowCreationInterval !== null && windowCreationInterval >= 0) {
let window = this.openWindow();
const closeState = { subscriber: this, window, context: <any>null };
const creationState: CreationState<T> = { windowTimeSpan, windowCreationInterval, subscriber: this, scheduler };
this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState));
this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState));
} else {
let window = this.openWindow();
const timeSpanOnlyState = { subscriber: this, window, windowTimeSpan };
this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState));
}
Expand Down Expand Up @@ -163,7 +163,7 @@ interface TimeSpanOnlyState<T> {
function dispatchWindowTimeSpanOnly<T>(this: Action<TimeSpanOnlyState<T>>, state: TimeSpanOnlyState<T>) {
const { subscriber, windowTimeSpan, window } = state;
if (window) {
window.complete();
subscriber.closeWindow(window);
}
state.window = subscriber.openWindow();
this.schedule(state, windowTimeSpan);
Expand Down

0 comments on commit b6f6ed4

Please sign in to comment.