Skip to content

Recover provider reads with up to three retries on server errors - #1750

Merged
kevmo314 merged 1 commit into
mainfrom
fix/provider-read-retries
Oct 30, 2026
Merged

kevmo314 merged 1 commit into
mainfrom
fix/provider-read-retries

Conversation

@kevmo314

Copy link
Copy Markdown
Contributor

Provider reads such as /getEmotes currently fail immediately on an upstream 5xx response, even if the next request would succeed. Retry these reads before reporting an exhausted failure.

The shared Client.Get helper now makes up to three retries after the initial attempt (four requests maximum), using the existing 1/2/4-second exponential backoff and provider retry headers. Waiting respects request cancellation and deadlines, and each response body is closed before retrying. Non-5xx failures are returned immediately. Raw Do remains single-attempt so existing EventSub retry policies are not multiplied and side-effecting requests are not blindly replayed.

Validation:

  • Tests cover recovery after three failures, retry exhaustion, backoff timing, Retry-After, cancellation/deadlines, response cleanup, and no retries for client or decoding errors.
  • An emote callable integration test verifies a transient provider 503 recovers to HTTP 200 without an error alert; existing tests still verify POST requests are not retried.
  • CI=true TWITCH_CLI=/tmp/rtchat-twitch-cli/twitch go test -race ./..., go vet ./..., gofmt checks, and monitoring unit tests pass.

Complements #1749: failures that remain after retries retain their diagnostic context.

@kevmo314
kevmo314 merged commit f313dd9 into main Oct 30, 2026
8 checks passed
@kevmo314
kevmo314 deleted the fix/provider-read-retries branch October 30, 2026 04:06
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