-
Notifications
You must be signed in to change notification settings - Fork 1
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
simplify retry logic & API #2
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Matthew M. Keeler <keelerm84@gmail.com>
…-eventsource into eb/sc-133323/initial
…r-strategy # Conflicts: # ld_eventsource/sse_client.py
# Conflicts: # ld_eventsource/__init__.py # ld_eventsource/sse_client.py # requirements.txt # setup.py # testing/helpers.py # testing/test_sse_client_basic.py # testing/test_sse_client_retry.py
This pull request has been linked to Shortcut Story #133323: Break Python SSE client out of the SDK. |
…mpler-strategy # Conflicts: # ld_eventsource/sse_client.py # requirements.txt
keelerm84
approved these changes
Dec 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm revisiting some of my design decisions based on things I figured out when I rewrote the Java equivalent of this, https://github.com/launchdarkly/okhttp-eventsource.
I still think the general idea of
RetryDelayStrategy
, and the use of immutable instances to represent the changing state, makes sense. But I think I overthought the abstraction a bit; it's not really necessary to have separate backoff and delay strategies broken out. I've changed it so those are just parameters to a single default strategy, and if someone wants something very different from that logic, they can pretty easily implement it themselves.The other big difference here is that the "reset the retry delay if the connection has been OK for X amount of time" logic is no longer implemented inside the retry delay strategy. Instead, it's just a basic behavior of SSEClient, independent of what the retry delay strategy is. Since these instances are immutable, all that SSEClient needs to do to reset to the initial state is just to go back to the originally configured RetryDelayStrategy instance.