Skip to content

Conversation

@cosmastech
Copy link

@cosmastech cosmastech commented Jan 15, 2026

WHY are these changes introduced?

The current way this code is written, we always sleep after a retryable failure (429, 500). However, there are two scenarios:

  1. We only want to try the request once. We then are sleeping before returning, even though we will break out of the loop immediately after.
  2. We have multiple tries, but we have failed up the limit. Again, we are sleeping before returning a response.

WHAT is this pull request doing?

Moves the sleep statement to the beginning of the loop, executing only if we are on at least the second try.

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above
  • I have added/updated tests for this change
  • I have updated the documentation for public APIs from the library (if applicable)

@cosmastech
Copy link
Author

I have signed the CLA!

@cosmastech cosmastech changed the title [Fix] Move sleep on retryable error [Fix] Move sleep so it occurs only when retrying Jan 15, 2026
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.

1 participant