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

Fix swallowing exceptions and explicitly cap retries in process_response #753

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

albertyw
Copy link
Member

@albertyw albertyw commented Nov 3, 2024

This PR rewrites the retry logic in process_response to not use break in finally (#745) and to put an explicit cap of 2 attempts to process a response before letting the request continue on through the middleware.

The original code also implicitly had a cap of 2 attempts because finally: break would have executed regardless of if _process_response succeeded which meant there would always be either 1 attempt (try) or 2 attempts (try and except), never any more. The original likely meant to have else: break to retry forever, but retrying forever is likely undesirable in this situation.

Follows up on #140
Fixes #745

@albertyw albertyw merged commit c2b8ef5 into jazzband:master Nov 9, 2024
103 checks passed
@albertyw albertyw deleted the process-response branch November 9, 2024 06:57
@albertyw albertyw mentioned this pull request Nov 9, 2024
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.

break in finally can swallow exception
1 participant