run clenupo only when needed
This commit is contained in:
parent
95c929f8df
commit
8d708f66ad
|
@ -29,14 +29,18 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var cleanupNeeded bool
|
||||
for _, t := range tasks {
|
||||
if t.Dirty {
|
||||
if err := taskRepo.Update(t); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
cleanupNeeded = true
|
||||
}
|
||||
}
|
||||
if cleanupNeeded {
|
||||
if err := taskRepo.CleanUp(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue