fix: increase consumer error tolerance for transient infra outages#900
Merged
Conversation
Previously the consumer gave up after 5 consecutive receive errors with a 5s backoff cap (~3s total tolerance), permanently killing the worker with no recovery path. A brief broker hiccup (e.g. GCP OAuth/DNS blip, managed broker restart) was enough to take down logmq/deliverymq workers across deployments until containers were manually restarted. Mirrors the same fix applied to the retrymq scheduler in #881. Increase to 10 errors with 15s backoff cap (~1 min tolerance window). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexbouchardd
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bump consumer retry defaults from
5 errors / 5s cap (~3s tolerance)to10 errors / 15s cap (~1 min tolerance).The consumer (
internal/consumer/consumer.go) driveslogmq-consumer,deliverymq-consumer, and other Pub/Sub-style workers. On asubscription.Receive()error it retries with exponential backoff, then permanently kills the worker oncemaxConsecutiveErrorsis reached — the supervisor does not restart it.With the previous defaults, a ~3-second blip (e.g. transient GCP OAuth token fetch / DNS timeout, brief managed broker restart) was enough to take a worker down until the container was manually restarted. Example real failure mode:
This mirrors the exact fix applied to the retrymq scheduler in #881, where a brief Dragonfly Cloud restart was killing retry workers across all deployments. Same pattern, different file — the consumer side never got the matching bump.
New retry schedule:
Defaults remain overridable via
WithMaxConsecutiveErrors/WithInitialBackoff/WithMaxBackoff.Test plan
go build ./internal/consumer/...go test ./internal/consumer/...— passes (existing tests pass explicit values viaWithMaxConsecutiveErrors, unaffected by default change)🤖 Generated with Claude Code