Skip to content

Conversation

@smypmsa
Copy link
Member

@smypmsa smypmsa commented Nov 4, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved stability of WebSocket metric cleanup by safely handling closed connections and preventing unnecessary operations that could cause errors.
  • Tests

    • Updated test infrastructure configuration for improved test coverage.

@smypmsa smypmsa self-assigned this Nov 4, 2025
@smypmsa smypmsa added the enhancement New feature or request label Nov 4, 2025
@vercel
Copy link

vercel bot commented Nov 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
chainstack-rpc-dashboard-germany Building Building Preview Comment Nov 4, 2025 4:03pm
chainstack-rpc-dashboard-japan Ready Ready Preview Comment Nov 4, 2025 4:03pm
chainstack-rpc-dashboard-singapore Building Building Preview Comment Nov 4, 2025 4:03pm
chainstack-rpc-dashboard-us-west Building Building Preview Comment Nov 4, 2025 4:03pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

WebSocket cleanup in the metric types module is enhanced with a connection state check to guard unsubscribe calls, preventing unnecessary operations on closed connections. A test import is updated to reference the arbitrum API handler instead of hyperliquid.

Changes

Cohort / File(s) Summary
WebSocket Cleanup Guard
common/metric_types.py
Added connection state validation before unsubscribe in WebSocket metric cleanup; unsubscribe is skipped if connection is closed, while close operation remains unchanged. Existing error handling for CancelledError and exceptions preserved.
Test Handler Import Update
tests/test_api_read.py
Changed HTTP handler import source from api.read.hyperliquid to api.read.arbitrum; server setup unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • common/metric_types.py: Straightforward connection state guard pattern; verify logic is correct and idempotent close behavior is maintained
  • tests/test_api_read.py: Trivial import change; verify arbitrum handler is the correct replacement

Possibly related PRs

Poem

🐰 A websocket's thread unwinds with care,
We check if connection's still there—
No unsubscribe on a closed line,
And arbitrum's handler works just fine! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/websocket-metric-drop

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7d9abc and f59a2dd.

📒 Files selected for processing (2)
  • common/metric_types.py (1 hunks)
  • tests/test_api_read.py (1 hunks)

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants