fix(eventing): back off outbox retries and make dead-letters recoverable#1336
Merged
iammukeshm merged 1 commit intoJul 13, 2026
Merged
Conversation
REL-02: a failing outbox message was retried on every dispatch cycle (~10s) with no backoff, hit IsDead after 5 tries in ~50s, and was then lost — no replay path and no metric, only a log line. - Add NextRetryAt with exponential backoff (base 30s, cap 1h; configurable via EventingOptions). The dispatch batch skips messages whose NextRetryAt is in the future. - Add IOutboxStore.GetDeadLetteredAsync + RedriveDeadLettersAsync to inspect and reset dead-lettered messages for another attempt. - Add an OpenTelemetry meter (FSH.Eventing) with dead-letter and redrive counters so the condition is alertable, not just greppable in logs. Additive migration (nullable NextRetryAt column, Identity schema). Redis/infra unchanged.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Fixes audit finding REL-02.
Problem
A failing outbox message was retried on every dispatch cycle (~10s) with no backoff, hit
IsDeadafter 5 attempts in ~50s, and was then lost:IsDeadappears only in the store/entity/migrations — there was no replay path and no metric, only a log line. So a persistently failing integration event hammered the bus for ~50s and then silently vanished.Fix
NextRetryAtcolumn with exponential backoff (base * 2^(n-1), default base 30s, cap 1h; both configurable viaEventingOptions).GetPendingBatchAsyncskips messages whoseNextRetryAtis still in the future, so retries space out instead of re-firing each cycle.IOutboxStore.GetDeadLetteredAsynclists dead-lettered messages andRedriveDeadLettersAsync(ids?)resets them (clearsIsDead/RetryCount/LastError/NextRetryAt) for another attempt.FSH.Eventingwithfsh.eventing.outbox.deadletteredandfsh.eventing.outbox.redrivencounters, registered in the OTel setup, so dead-lettering is alertable rather than only visible via the existingErrorlog.Migration
Additive only: a nullable
NextRetryAtcolumn onOutboxMessages(Identity schema — the sole outbox-backed context). No drops, expand-safe.Tests
OutboxRetryTests(Testcontainers, real Postgres via the Identity store): a non-dead failure schedules a futureNextRetryAtand is excluded from the pending batch; a redrive resets a dead-lettered message and makes it pending again. Full Integration suite green (732 passed).Follow-up
Redrive is exposed as a store API; wiring an admin endpoint or
fshCLI verb to trigger it operationally is a small follow-up. Docs changelog entry to follow.