BackupDir: make constructor fallible

since converting from i64 epoch timestamp to DateTime is not always
possible. previously, passing invalid backup-time from client to server
(or vice-versa) panicked the corresponding tokio task. now we get proper
error messages including the invalid timestamp.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2020-09-11 14:34:38 +02:00
committed by Dietmar Maurer
parent 7158b304f5
commit e0e5b4426a
6 changed files with 41 additions and 34 deletions

View File

@ -347,7 +347,7 @@ pub async fn pull_group(
let mut remote_snapshots = std::collections::HashSet::new();
for item in list {
let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time);
let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time)?;
// in-progress backups can't be synced
if let None = item.size {