feat: add circuit breaker for Stellar RPC failures#293
Closed
GautamKumarOffical wants to merge 1 commit into
Closed
feat: add circuit breaker for Stellar RPC failures#293GautamKumarOffical wants to merge 1 commit into
GautamKumarOffical wants to merge 1 commit into
Conversation
Implements a circuit breaker pattern with 3 states (CLOSED, OPEN, HALF_OPEN) to prevent cascading failures when the Stellar RPC node is degraded. - Circuit opens after 5 consecutive failures within 60 seconds - When open, requests fail immediately without calling RPC - After 30 seconds, transitions to HALF_OPEN with 1 test request - State changes logged and exposed via Prometheus metrics - Configurable thresholds via env vars Closes BountyOnChain#202 Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
11 tasks
Contributor
|
I'd like to work on this. Approach:
Estimated effort: ~1-2 hours. PR incoming shortly. |
Contributor
|
Thanks for the PR. Two things: CI has a failing Backend check on this branch, and issue #202 is assigned to @teethaking — only the assigned contributor's PR is being merged here. Worth coordinating in the issue thread. |
Contributor
|
Closing this — #202 is assigned to @teethaking. Thanks for the 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.
Implements a circuit breaker pattern to prevent cascading failures when the Stellar RPC node is experiencing issues.
Changes
New file:
apps/backend/src/common/circuit-breaker.tsNew file:
apps/backend/src/common/circuit-breaker.spec.tsModified:
apps/backend/src/submissions/submissions.service.tsModified:
apps/backend/src/metrics/metrics.service.tsstellar_bounty_circuit_breaker_state(0=closed, 1=open, 2=half_open)stellar_bounty_circuit_breaker_state_changes_totalConfiguration (env vars)
CIRCUIT_BREAKER_FAILURE_THRESHOLD(default: 5)CIRCUIT_BREAKER_FAILURE_WINDOW_MS(default: 60000)CIRCUIT_BREAKER_OPEN_TIMEOUT_MS(default: 30000)How it works
Closes #202