feat(backend): enhance error recovery for Trustline Manager#858
Merged
emdevelopa merged 1 commit intoMay 31, 2026
Conversation
- Replace single global circuit breaker with per-context registry so failure domains are fully isolated (a Horizon surge won't block DB ops) - Add half-open state: one probe attempt before re-closing the breaker - Wrap every operation in a configurable hard timeout (default 15 s) to prevent runaway async calls from stalling the retry loop - Add in-memory dead-letter queue (capped at 100 entries) for unrecoverable failures; expose getDeadLetterQueue / drainDeadLetterQueue - Support pluggable fallback handlers so callers can return cached / degraded data instead of bubbling an error to the client - Expose getCircuitBreakerMetrics() for health/monitoring endpoints - Extend error classification with timeout and auth error categories - Add 27 new targeted tests (48 total, all passing) covering per-context isolation, half-open probing, timeout, DLQ, and fallback behaviour Closes emdevelopa#746
|
@dannyy2000 is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@dannyy2000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Map), isolating failure domains so a Horizon outage cannot block unrelated DB operationswithTimeout()to prevent runaway async calls from locking up the retry loopgetDeadLetterQueue()anddrainDeadLetterQueue()for inspection and replayasync fallback(err)that returns cached / degraded data when all retries are exhausted or the circuit is opengetCircuitBreakerMetrics()for integration with health and monitoring endpointsTest plan
npx vitest run src/lib/trustline-manager.test.js— 48/48 tests passSecurity notes
Closes #745
Closes #746
Closes #747
Closes #748