This repository was archived by the owner on Jan 27, 2026. It is now read-only.
Improvement: concurrent node invitation#294
Merged
Merged
Conversation
- Leverage asynchronism instead of awaiting for every invitation - Remove some copies - Solves PrimeIntellect-ai#232
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the node invitation process by sending invitations concurrently rather than sequentially and introduces a constant to limit the number of futures running at once.
- Modified _generate_invite and _send_invite to take references instead of owning their node parameter
- Replaced sequential processing in process_uninvited_nodes with a futures stream to limit concurrency using DEFAULT_INVITE_CONCURRENT_COUNT
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
Apr 27, 2025
- Much like PrimeIntellect-ai#294, but also applied to discovery and node.
JannikSt
approved these changes
Apr 28, 2025
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
Apr 30, 2025
- Much like PrimeIntellect-ai#294, but also applied to discovery and node.
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
May 24, 2025
- Much like PrimeIntellect-ai#294, but also applied to discovery and node.
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
May 24, 2025
- Much like PrimeIntellect-ai#294, but also applied to discovery and node.
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
May 24, 2025
- Much like PrimeIntellect-ai#294, but also applied to discovery and node.
gsegatti
added a commit
to gsegatti/protocol
that referenced
this pull request
May 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #232.
This PR changes
process_uninvited_nodesso that invites are sent concurrently instead of one-by-one.It introduces a constant
DEFAULT_INVITE_CONCURRENT_COUNTto limit the number of futures created at once, preventing potential DoS scenarios. The value is somewhat arbitrary, feel free to suggest a better default or remove it altogether if we're not worried about large count of invitations.