-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(pbs): batch size config for validators registration #244
Open
ManuelBilbao
wants to merge
7
commits into
main
Choose a base branch
from
mb/batch_validator_registration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+128
−15
Conversation
This file contains 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
ltitanb
reviewed
Jan 21, 2025
.in_current_span(), | ||
)); | ||
for relay in relays.clone() { | ||
if registrations.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there an use case for this? i think we either avoid checking or return Ok
Comment on lines
+49
to
+65
for batch in registrations | ||
.chunks( | ||
relay.config.validator_registration_batch_size.unwrap_or(registrations.len()), | ||
) | ||
.map(|chunk| chunk.to_vec()) | ||
.collect::<Vec<Vec<ValidatorRegistration>>>() | ||
{ | ||
handles.push(tokio::spawn( | ||
send_register_validator_with_timeout( | ||
batch, | ||
relay.clone(), | ||
send_headers.clone(), | ||
state.pbs_config().timeout_register_validator_ms, | ||
) | ||
.in_current_span(), | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
for batch in registrations | |
.chunks( | |
relay.config.validator_registration_batch_size.unwrap_or(registrations.len()), | |
) | |
.map(|chunk| chunk.to_vec()) | |
.collect::<Vec<Vec<ValidatorRegistration>>>() | |
{ | |
handles.push(tokio::spawn( | |
send_register_validator_with_timeout( | |
batch, | |
relay.clone(), | |
send_headers.clone(), | |
state.pbs_config().timeout_register_validator_ms, | |
) | |
.in_current_span(), | |
)); | |
} | |
let registrations = registrations.clone(); | |
if let Some(batch_size) = relay.config.validator_registration_batch_size { | |
for batch in registrations.chunks(batch_size) { | |
handles.push(tokio::spawn( | |
send_register_validator_with_timeout( | |
batch.to_vec(), | |
relay.clone(), | |
send_headers.clone(), | |
state.pbs_config().timeout_register_validator_ms, | |
) | |
.in_current_span(), | |
)); | |
} | |
} else { | |
handles.push(tokio::spawn( | |
send_register_validator_with_timeout( | |
registrations, | |
relay.clone(), | |
send_headers.clone(), | |
state.pbs_config().timeout_register_validator_ms, | |
) | |
.in_current_span(), | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added a new configuration
validator_registration_batch_size
for relays that splits the validators registration in batches.Logs for the following setup:
stdout:
JSON
Close #226