Skip to content

Retry transient GitHub API failures when fetching org DSN#92

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-error-investigation-448d
Draft

Retry transient GitHub API failures when fetching org DSN#92
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-error-investigation-448d

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 22, 2026

Summary

This PR hardens DSN config retrieval against transient GitHub network failures that were generating ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) in production.

Changes

  • Added bounded retries for transient requests failures (ConnectionError, Timeout) in fetch_dsn_for_github_org.
  • Added explicit request timeout for the GitHub API call to avoid hanging connections.
  • Added configurable retry/timeout constants via environment variables with safe defaults.
  • Improved logging to distinguish transient retries from final failure.
  • Added tests to verify:
    • timeout is passed to requests.get
    • transient connection failure retries and then succeeds
    • repeated transient failures raise after max attempts

Validation

  • python3 -m pytest -q passes in this branch.

Related

Open in Web View Automation 

Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
Comment thread src/sentry_config.py
Comment on lines +38 to +42
resp = requests.get(
api_url,
headers=headers,
timeout=GITHUB_API_TIMEOUT_SECONDS,
)
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.

2 participants