public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] datastore: snapshot iterator: avoid unnecessary string conversion
@ 2025-04-29 13:09 Christian Ebner
  2025-04-30 12:31 ` [pbs-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2025-04-29 13:09 UTC (permalink / raw)
  To: pbs-devel

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@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] datastore: snapshot iterator: avoid unnecessary string conversion
  2025-04-29 13:09 [pbs-devel] [PATCH proxmox-backup] datastore: snapshot iterator: avoid unnecessary string conversion Christian Ebner
@ 2025-04-30 12:31 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-04-30 12:31 UTC (permalink / raw)
  To: pbs-devel, Christian Ebner


On Tue, 29 Apr 2025 15:09:17 +0200, Christian Ebner wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] datastore: snapshot iterator: avoid unnecessary string conversion
      commit: dc324716a688a67d700fa133725740ac5d3795ce

Best regards,
-- 
Fabian Grünbichler <f.gruenbichler@proxmox.com>


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-30 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-29 13:09 [pbs-devel] [PATCH proxmox-backup] datastore: snapshot iterator: avoid unnecessary string conversion Christian Ebner
2025-04-30 12:31 ` [pbs-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal