remove sources invalid snapshots

This commit is contained in:
shoopea 2023-07-01 00:15:31 +02:00
parent c372d43104
commit db05789cfe
2 changed files with 10 additions and 5 deletions

7
app.go
View File

@ -156,7 +156,12 @@ func (a *App) Cleanup(now time.Time) error {
for _, src := range a.sources { for _, src := range a.sources {
for _, s := range cfg.box[src.Box()].zfs.filesystems[src.Path()].snapshots { 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("") log.WithFields(log.Fields{"app": a.name, "now": now, "box": src.Box(), "snapshot": s.String(), "call": "Expired", "error": err}).Errorf("")
return err return err
} else if expired { } else if expired {

View File

@ -1,7 +1,7 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "aa8d203" var githash = "c372d43"
var branch = "v2" var branch = "v2"
var buildstamp = "2023-06-30_20:03:47" var buildstamp = "2023-06-30_22:15:16"
var commits = "62" var commits = "63"
var version = "aa8d203-b62 - 2023-06-30_20:03:47" var version = "c372d43-b63 - 2023-06-30_22:15:16"