Skip to content

Fix swallowing exceptions and explicitly cap retries in process_response#753

Merged
albertyw merged 1 commit into
jazzband:masterfrom
albertyw:process-response
Nov 9, 2024
Merged

Fix swallowing exceptions and explicitly cap retries in process_response#753
albertyw merged 1 commit into
jazzband:masterfrom
albertyw:process-response

Conversation

@albertyw
Copy link
Copy Markdown
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
@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