layout: refactor/fix bad while loop
This commit is contained in:
parent
85b5a6bcd1
commit
adccce1145
@ -86,23 +86,20 @@ impl LayoutHistory {
|
|||||||
// remove them (keep them in self.old_versions).
|
// remove them (keep them in self.old_versions).
|
||||||
// ASSUMPTION: we only care about where nodes in the current layout version
|
// ASSUMPTION: we only care about where nodes in the current layout version
|
||||||
// are reading from, as we assume older nodes are being discarded.
|
// are reading from, as we assume older nodes are being discarded.
|
||||||
while self.versions.len() > 1 {
|
let current_nodes = &self.current().node_id_vec;
|
||||||
let current_nodes = &self.current().node_id_vec;
|
let min_version = self.min_stored();
|
||||||
let min_version = self.min_stored();
|
let sync_ack_map_min = self
|
||||||
let sync_ack_map_min = self
|
.update_trackers
|
||||||
.update_trackers
|
.sync_ack_map
|
||||||
.sync_ack_map
|
.min_among(current_nodes, min_version);
|
||||||
.min_among(current_nodes, min_version);
|
while self.min_stored() < sync_ack_map_min {
|
||||||
if self.min_stored() < sync_ack_map_min {
|
assert!(self.versions.len() > 1);
|
||||||
let removed = self.versions.remove(0);
|
let removed = self.versions.remove(0);
|
||||||
info!(
|
info!(
|
||||||
"Layout history: moving version {} to old_versions",
|
"Layout history: moving version {} to old_versions",
|
||||||
removed.version
|
removed.version
|
||||||
);
|
);
|
||||||
self.old_versions.push(removed);
|
self.old_versions.push(removed);
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while self.old_versions.len() > OLD_VERSION_COUNT {
|
while self.old_versions.len() > OLD_VERSION_COUNT {
|
||||||
|
Loading…
Reference in New Issue
Block a user