Skip to content

WIK-2212: Retry on Broken pipe and other transient network errors#9

Open
tosfos wants to merge 1 commit intomasterfrom
WIK-2212-broken-pipe-retry
Open

WIK-2212: Retry on Broken pipe and other transient network errors#9
tosfos wants to merge 1 commit intomasterfrom
WIK-2212-broken-pipe-retry

Conversation

@tosfos
Copy link
Contributor

@tosfos tosfos commented Feb 11, 2026

Summary

Addresses WIK-2212: AutoUAM gets Broken pipe errors frequently (e.g. on Wikizilla when enabling Under Attack Mode under high load).

Changes

  • Retry loop in CloudflareClient._request: up to 3 attempts with exponential backoff (1s, 2s, 4s).
  • Session refresh on retry: on retryable errors (Broken pipe, ConnectionError, aiohttp.ClientError / ServerDisconnectedError / ClientConnectorError, ConnectionResetError), the client closes the session and creates a new one on the next attempt so the retry uses a fresh TCP connection.
  • Logging: logs "Network error, retrying" with error, attempt, and wait_time for observability (aligned with existing log format seen in Jira).

API failures (CloudflareError) are not retried. All 24 existing tests pass.

- Add retry loop (3 attempts) in CloudflareClient._request with exponential
  backoff (1s, 2s, 4s) and session refresh on retryable errors.
- On Broken pipe, ConnectionError, aiohttp ClientError/ServerDisconnected,
  close the session and retry with a fresh connection.
- Log 'Network error, retrying' with attempt and wait_time for observability.

Co-authored-by: Cursor <cursoragent@cursor.com>
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