fix(rpc-pool): move timeout.cancel() to finally block#182
fix(rpc-pool): move timeout.cancel() to finally block#1826figpsolseeker wants to merge 1 commit intodcccrypto:mainfrom
Conversation
The timeout timer created by rejectAfter() was cancelled in both the try block (line 485, on success) and the catch block (line 490, on error). If an exception was thrown inside the catch block before reaching the cancel call (e.g., during ep.failures++ on a corrupted endpoint object, or in the verbose logging path), the timer would leak and fire after the call() method had already returned or thrown. Moving timeout.cancel() to a finally block guarantees cleanup regardless of how the try/catch exits: normal return, caught error with retry, or re-thrown error from the non-retryable path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 3 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The timeout timer created by
rejectAfter()was cancelled in both thetryblock (on success) and thecatchblock (on error). If an exception was thrown inside the catch block before reachingtimeout.cancel(), the timer would leak and fire aftercall()had already returned.Changes
timeout.cancel()from try and catch blocks, added afinallyblock that guarantees cleanup.Test plan
npm run lintcleannpx vitest run test/rpc-pool.test.ts— all 57 tests passvitest run: same 14 pre-existing failures, zero new failures