Fix: one failing exporter should not abort the others#754
Merged
Conversation
When any exporter's exportTransactions throws, the catch block re-throws and Promise.all(exportPromises) rejects fail-fast. This orphans any still-running exporters, skips the summary log, and prevents the EXPORT_PROCESS_END event from firing. Fix: - Remove the re-throw in the per-exporter catch block. The outcome is already recorded via successCount/failedCount counters and the EXPORTER_ERROR event. - Switch Promise.all to Promise.allSettled so an error outside the try/catch still cannot abort other exporters or skip the summary. Add unit tests: one exporter throwing does not prevent the others from running, and the function resolves (does not reject) with a partial result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🎉 This PR is included in version 2.18.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
When one exporter's
exportTransactionsthrows, the entire export pipeline aborts:Promise.all(exportPromises)rejects fail-fastlog.summary()never runsEXPORT_PROCESS_ENDevent never firesyarn scrapeexits non-zeroA single exporter hitting a runtime error prevents all other exporters from completing, even though their work is independent.
Fix
throw ein the per-exporter catch block. The outcome is already recorded viasuccessCount/failedCountcounters and theEXPORTER_ERRORevent — re-throwing adds nothing but the fail-fast behavior.Promise.all→Promise.allSettledso an error outside the try/catch still cannot abort other exporters or skip the summary.Added unit tests covering both invariants:
Verification
yarn test:main→ 45 passedyarn typecheck:main→ cleanyarn lint→ clean