-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(windowTime): maxWindowSize parameter in windowTime operator #2187
feat(windowTime): maxWindowSize parameter in windowTime operator #2187
Conversation
This LGTM... @kwonoj can I get a second review here? |
src/operator/windowTime.ts
Outdated
this.numberOfNextedValues++; | ||
} | ||
|
||
getNumberOfNextedValues() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this need to be function? seems
public get nextedValueLength() {
return this.numberOfNextedValues;
}
would work. Nitpicking though.
src/operator/windowTime.ts
Outdated
@@ -49,6 +60,8 @@ import { Subscription } from '../Subscription'; | |||
* @param {number} windowTimeSpan The amount of time to fill each window. | |||
* @param {number} [windowCreationInterval] The interval at which to start new | |||
* windows. | |||
* @param {number} [maxWindowSize=Numbe.POSITIVE_INFINITY] Max number of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo s/Numbe.POSITIVE_INFINITY/Number.POSITIVE_INFINITY
LGTM, minor nitpicking suggestions but it should not block check in PR and can be updated later. |
src/operator/windowTime.ts
Outdated
|
||
next(value?: T) { | ||
super.next(value); | ||
this.numberOfNextedValues++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This increment needs to happen before we super.next(value)
otherwise someone can recursively reenter and never reach the max count because it hasn't been incremented yet.
@Blesh and I were talking about this a bit and want to hold off merging, but may merge when we have time to flush our concerns that were discovered. Sit tight. 👍 |
I think we're going to leave this one for the next minor version. There are a few issues I can see around reentracy (that @jayphelps pointed out), and some tweaks I'd like to make. |
Any way I can help with this one some more, or should I just leave it for now? |
@Podlas29 leave for now, we'll elaborate soon. 🤘 |
@Podlas29 we discussed this at our core team meeting today. We dig it, but it has that reentry problem that I commented on: #2187 (comment) It unfortunately is also now out of date due to some recent changes in #2277 and #2278. Resolving the conflicts might be a bit involved, cause we don't want to accidentally lose those other changes too. Could you give it a try for us and fix the reentry problem by moving the |
@jayphelps No problem, I'm on it. |
@jayphelps ok should be fine now. I made requested changes to order of operations, fixed typo and rebased to current master as carefully as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Can I get one other review from someone please? Perhaps @kwonoj since he touched this code most recently. (I see you reviewed it earlier, but he had to resolve conflicts on rebase against your changes so want your eyes)
src/operator/windowTime.ts
Outdated
private numberOfNextedValues: number; | ||
constructor() { | ||
super(); | ||
this.numberOfNextedValues = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make 148 private numberof.. = 0
and remove ctor.
src/operator/windowTime.ts
Outdated
super.next(value); | ||
} | ||
|
||
getNumberOfNextedValues(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this one we can simply make it as getter property?
private _numberOfNextedValues: number = 0;
public get numberOfNextedValues() {
return this._numberOfNextedValues;
}
This also fits for our further directions to follow private property convention (_xxx
) for JS users.
Minor nitpicking, and needs rebase - I know it's not conflicting but not reflect recent type inference in test, enabling it will check new tests conforms type inferences as well. Once it's rebased I'll check & merge. |
@kwonoj rebased against upstream/master |
Adds new parameter in windowTime operator to control how much values given window can emit. Closes #1301
@kwonoj I made the changes you requested. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
Adds new parameter in windowTime operator to control how much values given
window can emit.
Related issue (if exists):
Closes #1301