backup: switch over to streaming Iterator improving memory usage

Avoid collecting the whole group list in memory only to iterate and
filter over it again.

Note that the change could result in a indentation change, so best
viewed with `-w` flag.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht committed 2022-04-15 12:38:16 +02:00
1 parent 7b125de3e1
commit 249dde8b63
4 files changed
+55 -64

No files matched your search

+1 -2
View File
@@ -537,9 +537,8 @@ pub fn verify_all_backups(
}
};
let mut list = match verify_worker.datastore.list_backup_groups() {
let mut list = match verify_worker.datastore.iter_backup_groups_ok() {
Ok(list) => list
.into_iter()
.filter(|group| !(group.backup_type() == "host" && group.backup_id() == "benchmark"))
.filter(filter_by_owner)
.collect::<Vec<BackupGroup>>(),