-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Flux.cache(0) doesn't replay the terminal signal #3164
Comments
Thank you for the report. We are aware of the issue and it might require some significant design decisions to fix. Unfortunately, for the time being, I have no immediate workaround for the situation where the source terminates. For full disclosure, the cause for this is that when the underlying |
I am not an expert, but to me, what needs to be done is quite simple. Obviously, FluxPublish should not be used for cache(0). The comment in Flux.cache(int history) is misleading at best. if (history == 0) {
//TODO Flux.replay with history == 0 doesn't make much sense. This was replaced by Flux.publish, but such calls will be rejected in a future version
return onAssembly(new FluxPublish<>(this, Queues.SMALL_BUFFER_SIZE, Queues.get(Queues.SMALL_BUFFER_SIZE)));
} That leaves two options:
Did I miss something ? |
The request rate (if it is the right term) of If |
Thanks for the suggestions @plcarmel. We had a bit of a discussion around this problem and the background of the current state of affairs. It looks like we can try to incorporate your suggestions and make this case work as expected. I'll experiment and try to implement it. |
No problem @chemicL, thank you for taking the time to address this. Concerning The problem is that I was testing There is no back-pressure where there are no subscribers, but there is some when someone subscribes, and the fact that the Flux is hot doesn't mean that it doesn't respect back-pressure, it just means that it runs even when there are no subscribers. I understand that better now.
Damn it, I did it again. No, because there can be multiple subscribers. We have to use |
@plcarmel please have a look at the latest 3.4.x snapshot and test with your use case. Feedback is welcome. The implementation resides in |
Thank you @chemicL, that's awesome ! Yes, I think having the implementation in And thank you for the caveat in your commit message. It would be nice if it could make its way in the documentation (warning: this case is not implemented yet ...). From the commit message:
|
@plcarmel would you like to submit a PR with updates to the javadoc so it reflects what you'd expect to read? I guess I wouldn't do a better job at it than a conscious user :) |
Slowly looking into this. |
@chemicL, couldn't I could create a new ticket for this, and an associated PR. That would be an easy first code contribution for me. |
That sounds like a good idea. It still does not honour the TTL as other cases of non-zero history, which would reset themselves after the TTL. But it is an improvement to the current fallback to plain |
That way, we will be honouring the TTL and we will cache only the terminal signal. For replay: |
The fetching behaviour would be different though (than with only |
Ugh, please don't comment on this, I don't think it would work. I will do my homework and test my things first. |
Flux.cache(0) doesn't replay the terminal signal for late subscribers, contrary to what is stated in the documentation.
Here is an example:
No complete signal and thus no "hello world".
Tested with 3.4.17 and 3.4.22
Documentation says:
"Note that cache(0) will only cache the terminal signal without expiration. "
Which I understand as meaning that the signal will be replayed for late subscribers.
The text was updated successfully, but these errors were encountered: