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

Merged
merged 8 commits into from
May 26, 2025

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

@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

bmuddha and others added 7 commits May 26, 2025 20:52
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.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@bmuddha bmuddha force-pushed the bmuddha/fix/mutiple-ws-connections branch from 8f955db to b2d12e6 Compare May 26, 2025 16:54
@bmuddha bmuddha merged commit 08ae5c7 into master May 26, 2025
4 checks passed
@bmuddha bmuddha deleted the bmuddha/fix/mutiple-ws-connections branch May 26, 2025 17:13
thlorenz added a commit that referenced this pull request Jun 4, 2025
* master:
  feat: update mdp dependency + tests
  fix: use mutiple connections for ws subscriptions (#365)
  feat: allow for multiple ws endpoints in remote config (#372)
  Raise mdp version + update artifacts & improve error logging (#368)
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