-
Notifications
You must be signed in to change notification settings - Fork 699
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
elastic scaling: preserve candidate ordering in provisioner #3778
Conversation
…tering candidates with validation code updates
The CI pipeline was cancelled due to failure one of the required jobs. |
let mut stop_at_index = None; | ||
for (index, candidate) in para_candidates.iter().enumerate() { | ||
if candidate.candidate().commitments.new_validation_code.is_some() { | ||
if with_validation_code { | ||
stop_at_index = Some(index); | ||
break | ||
} else { | ||
with_validation_code = true; | ||
} | ||
} | ||
|
||
with_validation_code = true; | ||
} | ||
|
||
true | ||
}); | ||
if let Some(stop_at_index) = stop_at_index { | ||
merged_candidates.extend(para_candidates.into_iter().take(stop_at_index)); | ||
} else { | ||
merged_candidates.extend(para_candidates.into_iter()); | ||
} |
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.
We could get rid of the stop_index
and do something like this:
for candidate in para_candidates.into_iter() {
merged_candidates.push(candidate);
// Stop accumulating at first candidate with code upgrade.
if candidate.candidate().commitments.new_validation_code.is_some() {
break
}
}
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.
we don't want to stop accumulating after the first code upgrade. we just want to not accumulate any more code upgrades after the first code upgrade.
I modified the code to not use a stop_at_index though. I figured it must be more performant to batch extend a vec than pushing one-by-one. However, it's likely negligible anyway and it's less readable
#3742