Skip to content

fix: use mutiple connections for ws subscriptions #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bmuddha
Copy link
Contributor

@bmuddha bmuddha commented May 15, 2025

This fix rewrites the way account subscriptions work in the cloning pipeline, instead of using a single connection per shard, we now use pool of connections, which are used to distribute subscriptions, giving us more subscription capacity, before threshold imposed by RPC provider is reached.

closes gh-362

Greptile Summary

This PR implements a WebSocket connection pool for account subscriptions to increase capacity before hitting RPC provider limits. The changes replace single-connection architecture with a distributed approach.

  • Added PubsubPool in remote_account_updates_shard.rs to manage multiple WebSocket connections (8 per RPC upstream)
  • Modified test setup in remote_account_updates.rs to include 5-second delay for connection establishment
  • Added connection tracking and subscription distribution logic across pool
  • Uses unsafe transmute for stream lifetime extension which should be reviewed carefully
  • Implements proper cleanup of subscriptions and connections during shutdown

This fix rewrites the way account subscriptions work in the cloning
pipeline, instead of using a single connection per shard, we now use
pool of connections, which are used to distribute subscriptions, giving
us more subscription capacity, before threshold imposed by RPC provider
is reached.
@bmuddha bmuddha requested review from thlorenz and GabrielePicco May 15, 2025 08:29
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

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.

Bug: FailedToGetSubcriptionSlot
2 participants