From 481dddfc86b1a6e57f9a8ae151133107897b6976 Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Fri, 13 Jan 2017 23:35:00 -0800 Subject: [PATCH] fix(windowTime): clean up closed window with timeSpanOnly --- src/operator/windowTime.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/operator/windowTime.ts b/src/operator/windowTime.ts index 4e8b2746d4..3c563ee719 100644 --- a/src/operator/windowTime.ts +++ b/src/operator/windowTime.ts @@ -113,14 +113,14 @@ class WindowTimeSubscriber extends Subscriber { private windowCreationInterval: number, private scheduler: IScheduler) { super(destination); + + const window = this.openWindow(); if (windowCreationInterval !== null && windowCreationInterval >= 0) { - let window = this.openWindow(); const closeState: CloseState = { subscriber: this, window, context: null }; const creationState: CreationState = { 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: TimeSpanOnlyState = { subscriber: this, window, windowTimeSpan }; this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState)); } @@ -174,7 +174,7 @@ class WindowTimeSubscriber extends Subscriber { function dispatchWindowTimeSpanOnly(this: Action>, state: TimeSpanOnlyState): void { const { subscriber, windowTimeSpan, window } = state; if (window) { - window.complete(); + subscriber.closeWindow(window); } state.window = subscriber.openWindow(); this.schedule(state, windowTimeSpan);