-
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
Passing date into subsequent delay operators seem to accumulate delay #5232
Comments
Yeah. This is a bug. You can see here that when the rxjs/src/internal/operators/delay.ts Lines 60 to 65 in 56e7ceb
However, that calculation doesn't - and cannot easily - account for other |
Yep as you say, not an easy fix - probably a complete rewrite of the operator to not use date differentials. For anybody else following this, the workaround is pretty simple: of(null).pipe(
delay(initTimePlus5s),
tap(() => console.log('initTimePlus5s')),
delay(initTimePlus10s.getTime() - initTimePlus5s.getTime()),
tap(() => console.log('initTimePlus10s')),
).subscribe(); Unfortunately it's very easy to be caught out by this bug. Thanks for your help. |
It also isn't clear from the documentation what the expected behavior of the delay to date feature is. Should the notifications be delayed until that time and then emitted ASAP, or should the timing between them be maintained? |
- Resolves an issue where passing a Date would cause every value to be scheduled incorrectly, instead of delaying all values until the absolute date -- as documented. - Resolves an issue where negative numbers were treated as though they were positive numbers - Reduces operator sizes - Adds comments and formatting - Updates tests to reflect better behavior - Adds test for Dates in the past. fixes ReactiveX#5232
- Resolves an issue where passing a Date would cause every value to be scheduled incorrectly, instead of delaying all values until the absolute date -- as documented. - Resolves an issue where negative numbers were treated as though they were positive numbers - Reduces operator sizes - Adds comments and formatting - Updates tests to reflect better behavior - Adds test for Dates in the past. fixes ReactiveX#5232
- Resolves an issue where passing a Date would cause every value to be scheduled incorrectly, instead of delaying all values until the absolute date -- as documented. - Resolves an issue where negative numbers were treated as though they were positive numbers - Reduces operator sizes - Adds comments and formatting - Updates tests to reflect better behavior - Adds test for Dates in the past. fixes ReactiveX#5232
Bug Report
Current Behavior
When using the delay operator multiple times, and each time passing a date object into it, subsequent delay operators seem to accumulate the date differential from previous delay operators. See reproduction url for a code example.
Reproduction
https://stackblitz.com/edit/typescript-rx-playground-4fssrc?file=index.ts
Expected behavior
Environment
The text was updated successfully, but these errors were encountered: