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

simplify retry logic & API #2

Merged
merged 36 commits into from
Dec 29, 2022
Merged

Conversation

eli-darkly
Copy link
Contributor

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.

# 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
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #133323: Break Python SSE client out of the SDK.

@eli-darkly eli-darkly changed the title simplify retry logic & API WIP: simplify retry logic & API Dec 29, 2022
@eli-darkly eli-darkly changed the title WIP: simplify retry logic & API simplify retry logic & API Dec 29, 2022
@eli-darkly eli-darkly marked this pull request as ready for review December 29, 2022 18:18
@eli-darkly eli-darkly merged commit c9c67bb into main Dec 29, 2022
@eli-darkly eli-darkly deleted the eb/sc-133323/initial2-simpler-strategy branch December 29, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants