fix: resolve dangling timer, RPC burst, sparse array, and stale cache bugs (#550, #549, #548, #547) - #594
Open
markdavid000 wants to merge 3 commits into
Conversation
Capture the timer ID from setTimeout and call clearTimeout in a finally block after Promise.race resolves. This prevents the timer from keeping the Node event loop alive after a successful acquire, which could delay clean process exit and trigger open-handle warnings in test runs. Fixes conduit-protocol#550
Add a bounded concurrency helper (mapWithConcurrency) that processes items with at most N in-flight async calls. Use it for both the address pre-warm fan-out and the stream info fetching in pageFromFilteredIds. Previously list() issued up to 100 concurrent simulateTransaction RPCs per page via bare Promise.all, which routinely tripped provider rate limits and caused 429s for other in-flight SDK calls sharing the endpoint. The new default concurrency of 8 keeps throughput high while staying well under typical rate limits. Fixes conduit-protocol#549
…reamBatch Two fixes in Module49: 1. Sparse array (Issue conduit-protocol#548): processStreamBatch now pushes results into a dense array instead of assigning to pre-allocated slots, avoiding undefined holes when input items are falsy. Callers iterating the result no longer crash with 'Cannot read properties of undefined'. 2. Stale cache key (Issue conduit-protocol#547): The processSingleItem cache key now includes all fields read by withdrawableLocal (cancelled, pausedAt, ratePerSecond, startTime, endTime) in addition to the previously captured id, withdrawn, paused, and nowSec. This prevents stale cache hits when stream state changes within the same wall-clock second. Fixes conduit-protocol#548 Fixes conduit-protocol#547
|
@markdavid000 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
Fixes four bugs across NonceManager, StreamsModule, and Module49.
Changes
closes #550 — NonceManager.acquireWithFallback dangling setTimeout
setTimeouttimer ID and addedclearTimeoutin afinallyblock afterPromise.race.closes #549 — StreamsModule.list() unbounded concurrent RPCs
mapWithConcurrencyhelper that runs async tasks with a bounded worker pool (default concurrency: 8).Promise.allfan-outs inpageFromFilteredIdsfor both address pre-warm and stream info fetching.simulateTransactionRPCs per page from tripping provider rate limits and causing 429s for other in-flight SDK calls.closes #548 — Module49.processStreamBatch sparse array
push()into a dense array.undefinedholes that crash downstream.map()/for...ofiterations.closes #547 — Module49.processSingleItem stale cache key
withdrawableLocal:cancelled,pausedAt,ratePerSecond,startTime, andendTime.id,withdrawn,paused, andnowSecwere in the key, causing stale cache hits when stream state changed within the same wall-clock second.