Skip to content

Add Horizon API error recovery with exponential backoff #112

Description

@therealjhay

Description: When the Stellar Horizon API is temporarily unavailable or rate-limited, the app should retry with exponential backoff instead of immediately showing an error. This is especially important for balance refresh and transaction history.

Requirements:

  • Add a retry utility with exponential backoff (1s, 2s, 4s, 8s, max 30s)
  • Apply to Horizon API calls in the wallet store and any transaction fetching
  • Show a "Reconnecting..." indicator during retries
  • After 3 failed retries, show the error with a manual "Retry" button
  • Log retry attempts for debugging

Suggested execution steps:

  1. Create lib/utils/retry.ts with a generic retryWithBackoff(fn, options) function
  2. In lib/store/walletStore.ts, wrap the refreshBalances Horizon call with retry
  3. Add a isReconnecting state to the store
  4. In the wallet page, show a subtle "Reconnecting..." banner when isReconnecting is true
  5. After max retries, show the error with a manual "Retry" button

Example commit message:

feat(stellar): add exponential backoff retry for Horizon API calls

Created retryWithBackoff utility with 1s→2s→4s→8s→max 30s backoff.
Applied to wallet balance refresh and all Horizon API calls. Shows
"Reconnecting..." indicator during retries, manual "Retry" on failure.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions