Skip to content
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

Behavior of delay inconsistent with completions. #4249

Closed
benlesh opened this issue Oct 11, 2018 · 2 comments · Fixed by #4444
Closed

Behavior of delay inconsistent with completions. #4249

benlesh opened this issue Oct 11, 2018 · 2 comments · Fixed by #4444
Labels
bug Confirmed bug

Comments

@benlesh
Copy link
Member

benlesh commented Oct 11, 2018

Currently, delay will delay the completion notification, but only if there is no nexted value (the source is "empty").

This just doesn't make any sense. It should either always delay notification of complete, or it shouldn't.

Personally, I think it should not delay notification of complete, given that it's a composable behavior that way. The other way it's not, it's hard to remove the delay once it's added, because it's more obscured from downstream consumers (outside of some crazy mulitcasting scenario)

@benlesh benlesh added the AGENDA ITEM Flagged for discussion at core team meetings label Oct 11, 2018
@benlesh
Copy link
Member Author

benlesh commented Dec 19, 2018

Core team agrees this should be fixed.

@benlesh benlesh added bug Confirmed bug and removed AGENDA ITEM Flagged for discussion at core team meetings labels Dec 19, 2018
@martinsik
Copy link
Contributor

It seems like the complete notification is always delayed right now. https://stackblitz.com/edit/rxjs-uxspew

delaying complete when source is empty:
https://github.com/ReactiveX/rxjs/blob/master/spec/operators/delay-spec.ts#L101-L109

delaying complete after next notifications:
https://github.com/ReactiveX/rxjs/blob/master/spec/operators/delay-spec.ts#L25-L36

If I understand it correctly delay should delay complete only if there're already scheduled values. Otherwise situations like of(1, 2, 3).pipe(delay(500)) would never emit anything because complete would be sent immediately before any of the values are reemitted. So in this case it'll wait until all scheduled values are reemitted and them complete.
If there are no scheduled values it can complete immediately after receiving complete from source.

@benlesh benlesh closed this as completed in 63b8797 Apr 3, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants