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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
615539d
initial implementation based on SSE client from Python SDK
eli-darkly Dec 30, 2021
aaca796
makefile fixes
eli-darkly Dec 30, 2021
e2e87cd
rm debugging
eli-darkly Dec 30, 2021
e41d913
major refactoring & cleanup, better encapsulation of retry logic
eli-darkly Jan 14, 2022
2b89408
misc fixes
eli-darkly Jan 14, 2022
c9b558f
move private methods to end
eli-darkly Jan 14, 2022
d06808b
remove restart method which can't work as currently implemented
eli-darkly Jan 19, 2022
740389f
fix types
eli-darkly Jan 19, 2022
718e334
update test deps
eli-darkly Jan 19, 2022
638c8d2
comments
eli-darkly Jan 19, 2022
4393d75
redefine jitter to be additive
eli-darkly Jan 19, 2022
25b5c27
also ensure backoff is additive
eli-darkly Jan 19, 2022
3c2d311
default jitter should be 100% since it is now additive
eli-darkly Jan 19, 2022
675a1ad
rm unused
eli-darkly Jan 19, 2022
b9b7c02
only close the pool if we created it, not the opposite
eli-darkly Jan 19, 2022
50cc1f9
Apply suggestions from code review
eli-darkly Jan 19, 2022
5b73f76
fix shutdown of pool
eli-darkly Jan 19, 2022
ab43395
Merge branch 'eb/sc-133323/initial' of github.com:launchdarkly/python…
eli-darkly Jan 19, 2022
ad49637
add missing annotation
eli-darkly Jan 19, 2022
d24f44b
specify module names
eli-darkly Jan 19, 2022
3858bd4
drop Python 3.6
eli-darkly Dec 29, 2022
705fa68
simplify retry delay logic
eli-darkly Dec 29, 2022
050f566
lint
eli-darkly Dec 29, 2022
b8c6a8b
lint
eli-darkly Dec 29, 2022
9b3769c
lint
eli-darkly Dec 29, 2022
4f6a133
lint
eli-darkly Dec 29, 2022
9f4c6af
better lint command
eli-darkly Dec 29, 2022
6fae797
Merge branch 'eb/sc-133323/initial' into eb/sc-133323/initial2-simple…
eli-darkly Dec 29, 2022
aa43676
fix dependencies
eli-darkly Dec 29, 2022
2198d25
rm obsolete module
eli-darkly Dec 29, 2022
f9ff512
fix test
eli-darkly Dec 29, 2022
90e2395
Merge branch 'main' into eb/sc-133323/initial2-simpler-strategy
eli-darkly Dec 29, 2022
f99e610
pin urllib3 to 1.x
eli-darkly Dec 29, 2022
aaad50d
fix type
eli-darkly Dec 29, 2022
e579d90
workaround for hang on close in contract tests
eli-darkly Dec 29, 2022
c0c1b20
Merge branch 'eb/sc-133323/urllib3-1.x' into eb/sc-133323/initial2-si…
eli-darkly Dec 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contract-tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Flask==2.0.2
urllib3>=1.22.0
urllib3>=1.22.0,<2
7 changes: 5 additions & 2 deletions contract-tests/stream_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def run(self):
request,
initial_retry_delay=millis_to_seconds(self.options.get("initialDelayMs")),
last_event_id=self.options.get("lastEventId"),
retry_filter=lambda _: RetryFilterResult(not self.closed),
logger=self.log,
defer_connect=True
)
Expand Down Expand Up @@ -111,7 +112,9 @@ def send_message(self, message):
self.log.error('Callback request failed: %s', e)

def close(self):
if self.sse:
self.sse.close()
self.closed = True
# SSEClient.close() doesn't currently work, due to urllib3 hanging when we try to force-close a
# socket that's doing a blocking read. However, in the context of the contract tests, we know that
# the server will be closing the connection anyway when a test is done-- so all we need to do is
# tell ourselves not to retry the connection when it fails, and setting self.closed does that.
self.log.info('Test ended')
2 changes: 2 additions & 0 deletions ld_eventsource/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from ld_eventsource.errors import *
from ld_eventsource.event import *
from ld_eventsource.request_params import *
from ld_eventsource.retry_delay_strategy import *
from ld_eventsource.retry_filter import *
from ld_eventsource.sse_client import *
5 changes: 0 additions & 5 deletions ld_eventsource/retry/__init__.py

This file was deleted.

93 changes: 0 additions & 93 deletions ld_eventsource/retry/backoff.py

This file was deleted.

116 changes: 0 additions & 116 deletions ld_eventsource/retry/jitter.py

This file was deleted.

Loading