fix: Add retry policy presets (aggressive/conservative)#714
Conversation
- ancore-org#601: [STELLAR] Add retry policy presets (aggressive/conservative) Closes ancore-org#601
|
Warning Review limit reached
More reviews will be available in 58 minutes and 21 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@10xwhoman 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! 🚀 |
Summary
Add retry policy presets for wallet and indexer call sites, wire
StellarClientto the conservative wallet preset by default, and document how apps override retry behavior under rate limits.Purpose / Motivation
Stellar Horizon and RPC endpoints can return HTTP 429 under load. Wallet flows and background indexers have different latency and resilience needs. Centralized presets make the right defaults easy to adopt while still allowing per-app overrides.
Changes Made
RETRY_PRESETS(wallet: 3 attempts / 200 ms,indexer: 5 attempts / 500 ms) frompackages/stellar/src/retry.tsretryOptionsFromPresetandresolveRetryOptionshelpers to convert presets intoRetryOptionsStellarClientto acceptretryPresetand default towallet, withretryOptionsmerged on topfetch, including success after retry andRetryExhaustedErroron exhaustionpackages/stellar/README.mddocumenting preset selection and override behaviorHow to Test
Run package tests:
Expected: all tests pass, including new
RETRY_PRESETSand client preset coverage.Verify default client preset:
Expected: client uses wallet preset (
maxRetries: 2,baseDelayMs: 200).Verify indexer override:
Expected: client uses indexer preset (
maxRetries: 4,baseDelayMs: 500).Verify custom override:
Expected:
maxRetriesis overridden while other wallet preset values remain.Breaking Changes
StellarClientdefault retry behavior changes from{ maxRetries: 3, baseDelayMs: 1000 }to the wallet preset{ maxRetries: 2, baseDelayMs: 200 }. Apps relying on the old implicit default can pass explicitretryOptionsto preserve prior behavior.Related Issues
Closes #601
Checklist