[pbs-devel] [PATCH proxmox-backup] datastore: snapshot iterator: avoid unnecessary string conversion
Christian Ebner
c.ebner at proxmox.com
Tue Apr 29 15:09:17 CEST 2025
Avoid converting the backup time string to the timestamp and back to
string again. `BackupDir::with_rfc3339` already performs the string
to time conversion, so use it over parsing the timestamp first only
to convert it back to string in `BackupDir::with_group`.
No functional changes intended.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
pbs-datastore/src/hierarchy.rs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/pbs-datastore/src/hierarchy.rs b/pbs-datastore/src/hierarchy.rs
index 25a4d3821..e0bf84419 100644
--- a/pbs-datastore/src/hierarchy.rs
+++ b/pbs-datastore/src/hierarchy.rs
@@ -56,12 +56,7 @@ impl Iterator for ListSnapshots {
};
if let Ok(name) = entry.file_name().to_str() {
if BACKUP_DATE_REGEX.is_match(name) {
- let backup_time = match proxmox_time::parse_rfc3339(name) {
- Ok(time) => time,
- Err(err) => return Some(Err(err)),
- };
-
- return Some(BackupDir::with_group(self.group.clone(), backup_time));
+ return Some(BackupDir::with_rfc3339(self.group.clone(), name.to_owned()));
}
}
}
--
2.39.5
More information about the pbs-devel
mailing list