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

Replay terminal signals to late subscribers in Flux.replay(int) and Flux.cache(int) #3200

Merged
merged 7 commits into from
Oct 3, 2022

Conversation

chemicL
Copy link
Member

@chemicL chemicL commented Sep 23, 2022

Supporting the caching of only terminal signals in case of Flux.replay(int) and Flux.cache(int) operators.

As it currently stands, these operators, when provided 0 as the argument, resort to behaving like Flux.publish() which differs in the way termination signals are handled by the > 0 cases. This change still uses the FluxPublish class to implement the logic, however with a few minor changes to its implementation.
First of all, FluxPublish resets itself after source termination to be able to connect() again. FluxReplay on the other hand, does not reset itself in the case of only buffering signals without timeout. Therefore, for the behaviour of caching the terminals, FluxPublish does not reset itself and replays the terminal when it receives a late subscription.
For cases with expiry (TTL arguments), FluxReplay does indeed reset itself. Therefore, the behaviour for the time constrained values remains as before, using FluxPublish implementation for the 0 history case, but without caching terminals, while not honouring the TTL. This case can be later implemented if needed.

@chemicL chemicL self-assigned this Sep 23, 2022
@chemicL chemicL changed the title Flux replay zero Replay terminal signals to late subscribers in Flux.replay(int) and Flux.cache(int) Sep 27, 2022
@chemicL chemicL marked this pull request as ready for review September 27, 2022 11:52
@chemicL chemicL requested a review from a team as a code owner September 27, 2022 11:52
Copy link
Contributor

@simonbasle simonbasle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@@ -120,15 +127,21 @@ public void subscribe(CoreSubscriber<? super T> actual) {
c = u;
}

inner.parent = c;
Copy link
Contributor

@OlegDokuka OlegDokuka Sep 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a behavior change. not sure about the impact but let's keep the old logic as it was

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. In the earlier stages this was necessary, but it should be only necessary in the previous logic. Restored.

@chemicL chemicL merged commit db8902d into 3.4.x Oct 3, 2022
@reactorbot
Copy link

@chemicL this PR seems to have been merged on a maintenance branch, please ensure the change is merge-forwarded to intermediate maintenance branches and up to main 🙇

@chemicL chemicL deleted the flux-replay-zero branch October 3, 2022 08:43
chemicL added a commit that referenced this pull request Oct 3, 2022
@chemicL chemicL added the type/enhancement A general enhancement label Oct 11, 2022
@OlegDokuka OlegDokuka added this to the 3.4.24 milestone Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants