-
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
throttleTime does not emit last value #3351
Comments
could you provide more details and reproductions steps ? |
Observable.timer(1000)
.throttleTime(500, undefined, { trailing: true })
.subscribe(x => console.log('value', x), undefined, () => console.log('complete'))
// completes without value I.e. if the source observable completes, the "current" throttled value will get lost. |
We need a reproduction please. :) |
Unlike auditTime, I feel throttleTime is mostly used to limit the number of calls to a certain function or of emissions of values. With the current implementation, the last value can be lost if the observable completes before the throttle time is up. I feel the last throttle value should be emitted right away in this case but can also be persuade that the we should wait until the throttleTime to emit. e.g. const e1 = hot('-a-xy-----b--x--cxx| ');
const e1subs = '^ !';
const t = time('----| ');
const expected = '-----y--------x-----(x|)'; |
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. |
throttleTime
does not have a_complete
handler which means that even if we specifytrailing: true
we might not get the last value of the stream.Not sure if this is intentional, but it seems rather unintuitive. Also looking at the spec test the end of stream scenario isn't really defined so it's difficult to tell how it should work.
The text was updated successfully, but these errors were encountered: