Skip to content

feat(transactions): add retry with backoff and document endpoint behavior - #454

Merged
Jambox11 merged 2 commits into
mux-labs:stagingfrom
priscaenoch:feature/343-344-transactions-retry-and-docs
Jun 27, 2026
Merged

feat(transactions): add retry with backoff and document endpoint behavior#454
Jambox11 merged 2 commits into
mux-labs:stagingfrom
priscaenoch:feature/343-344-transactions-retry-and-docs

Conversation

@priscaenoch

@priscaenoch priscaenoch commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • closes Transactions API: Add retry with backoff #343

  • closes Transactions API: Document endpoint behavior #344

  • TransactionRetryService (transaction-retry.service.ts): new injectable service implementing capped exponential backoff for Horizon/network transient failures. Retries on 5xx, 408, 429, and common connection error codes (ECONNRESET, ETIMEDOUT, etc.). Never retries 4xx Horizon rejections or AbortError. Delay, max attempts, and cap are configurable via env vars (TRANSACTION_RETRY_MAX_ATTEMPTS, TRANSACTION_RETRY_BASE_DELAY_MS, TRANSACTION_RETRY_MAX_DELAY_MS).

  • HorizonSubmissionService: refactored postToHorizon to delegate through TransactionRetryService when available (injected @Optional()), falling back to a single attempt — keeps existing tests green without requiring the retry service.

  • TransactionsModule: registers and exports HorizonSubmissionService and TransactionRetryService.

  • TransactionsController: added full @nestjs/swagger decorators (@ApiTags, @ApiOperation, @ApiBody, @ApiParam, @ApiQuery, @ApiResponse) to all seven endpoints, matching the existing pattern in PaymentsController.

Links

…vior

closes mux-labs#343, closes mux-labs#344

- Add TransactionRetryService with capped exponential backoff for
  transient Horizon/network failures (5xx, 408, 429, ECONNRESET, etc.).
  Non-transient errors (4xx, AbortError) are never retried.
- Wire TransactionRetryService into HorizonSubmissionService via an
  @optional() injection so the retry path is used automatically when
  the service is provided; falls back to a single attempt otherwise.
- Register TransactionRetryService as a provider and export in
  TransactionsModule.
- Add comprehensive unit tests for TransactionRetryService covering
  success on first attempt, exponential backoff, network errors,
  4xx non-retry, AbortError non-retry, exhaustion, per-call override,
  and delay cap.
- Add @nestjs/swagger decorators (@apitags, @apioperation, @ApiBody,
  @ApiParam, @apiquery, @apiresponse) to TransactionsController for
  all seven endpoints, matching the pattern used in PaymentsController.
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@priscaenoch 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! 🚀

Learn more about application limits

@Jambox11
Jambox11 merged commit ac52f89 into mux-labs:staging Jun 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transactions API: Document endpoint behavior Transactions API: Add retry with backoff

2 participants