Improves the performance of wallet import and address discovery by optimizing rate limiting!#528
Merged
Conversation
- Parallelize per-address API calls (UTXOs, txs, stats) using Promise.all - Parallelize external/internal chain discovery (both chains fetched concurrently) - Increase MAX_CONCURRENT_REQUESTS from 1 to 3 (~8.5 req/sec vs ~1 req/sec) - Reduce RATE_LIMIT_DELAY_MS from 1000ms to 350ms - Circuit breaker and exponential backoff handle any 429 errors gracefully These changes reduce wallet import time from ~40-50 seconds to ~5-10 seconds for a typical wallet with 15 used addresses. https://claude.ai/code/session_01T8hFWQAwQcbDckqR4zwNfF
…t-61Lnm perf: optimize wallet import transaction fetching speed
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.
This pull request significantly improves the performance of wallet import and address discovery by optimizing rate limiting and parallelizing previously sequential operations. The main changes focus on increasing throughput while still respecting upstream API limits, resulting in much faster wallet imports and address discovery.
Performance and Parallelization Improvements:
esplora-service.tsto allow up to 3 concurrent requests with a reduced delay of 350ms, increasing throughput to approximately 8.5 requests per second, which accelerates wallet imports without exceeding API rate limits.discoverUsedAddresses(inwallet-service.ts) to:getWalletData(inwallet-service.ts) by fetching UTXOs, transactions, and stats for each address in parallel, instead of sequentially, further speeding up wallet data loading.