Skip to content

fix(rpc-pool): move timeout.cancel() to finally block#182

Open
6figpsolseeker wants to merge 1 commit intodcccrypto:mainfrom
6figpsolseeker:fix/rpc-pool-timeout-finally
Open

fix(rpc-pool): move timeout.cancel() to finally block#182
6figpsolseeker wants to merge 1 commit intodcccrypto:mainfrom
6figpsolseeker:fix/rpc-pool-timeout-finally

Conversation

@6figpsolseeker
Copy link
Copy Markdown

Summary

The timeout timer created by rejectAfter() was cancelled in both the try block (on success) and the catch block (on error). If an exception was thrown inside the catch block before reaching timeout.cancel(), the timer would leak and fire after call() had already returned.

Changes

Test plan

  • npm run lint clean
  • npx vitest run test/rpc-pool.test.ts — all 57 tests pass
  • Full vitest run: same 14 pre-existing failures, zero new failures

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Warning

Rate limit exceeded

@6figpsolseeker has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 3 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c88a725a-4215-4e0c-b4f7-96926a4ddffc

📥 Commits

Reviewing files that changed from the base of the PR and between 2f80d79 and cd274ae.

📒 Files selected for processing (1)
  • src/solana/rpc-pool.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant