feat(transactions): add retry with backoff and document endpoint behavior - #454
Merged
Jambox11 merged 2 commits intoJun 27, 2026
Conversation
…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.
|
@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! 🚀 |
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
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 orAbortError. 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
postToHorizonto delegate throughTransactionRetryServicewhen available (injected@Optional()), falling back to a single attempt — keeps existing tests green without requiring the retry service.TransactionsModule: registers and exports
HorizonSubmissionServiceandTransactionRetryService.TransactionsController: added full
@nestjs/swaggerdecorators (@ApiTags,@ApiOperation,@ApiBody,@ApiParam,@ApiQuery,@ApiResponse) to all seven endpoints, matching the existing pattern inPaymentsController.Links