From db05789cfe1d130a705b7facba5d4f9b08677693 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 1 Jul 2023 00:15:31 +0200 Subject: [PATCH] remove sources invalid snapshots --- app.go | 7 ++++++- version.go | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app.go b/app.go index 88d4e3c..3d439ac 100644 --- a/app.go +++ b/app.go @@ -156,7 +156,12 @@ func (a *App) Cleanup(now time.Time) error { for _, src := range a.sources { for _, s := range cfg.box[src.Box()].zfs.filesystems[src.Path()].snapshots { - if expired, err := s.Expired(now); err != nil { + if !s.Valid() { + if err := s.Delete(); err != nil { + log.WithFields(log.Fields{"app": a.name, "now": now, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("") + return err + } + } else if expired, err := s.Expired(now); err != nil { log.WithFields(log.Fields{"app": a.name, "now": now, "box": src.Box(), "snapshot": s.String(), "call": "Expired", "error": err}).Errorf("") return err } else if expired { diff --git a/version.go b/version.go index 9d278f7..265857b 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "aa8d203" +var githash = "c372d43" var branch = "v2" -var buildstamp = "2023-06-30_20:03:47" -var commits = "62" -var version = "aa8d203-b62 - 2023-06-30_20:03:47" +var buildstamp = "2023-06-30_22:15:16" +var commits = "63" +var version = "c372d43-b63 - 2023-06-30_22:15:16"