Browse Source

Reverse cleanup order to handle interruptions better

tags/nilmtools-1.1.6
Jim Paris 8 years ago
parent
commit
372e977e4a
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      src/cleanup.py

+ 8
- 5
src/cleanup.py View File

@@ -238,12 +238,15 @@ def main(argv = None):
timestamp_to_seconds(total)))
continue
printf(" removing data before %s\n", timestamp_to_human(remove_before))
if args.yes:
client.stream_remove(path, None, remove_before)
for ap in streams[path].also_clean_paths:
printf(" also removing from %s\n", ap)
# Clean in reverse order. Since we only use the primary stream and not
# the decimated streams to figure out which data to remove, removing
# the primary stream last means that we might recover more nicely if
# we are interrupted and restarted.
clean_paths = list(reversed(streams[path].also_clean_paths)) + [ path ]
for p in clean_paths:
printf(" removing from %s\n", p)
if args.yes:
client.stream_remove(ap, None, remove_before)
client.stream_remove(p, None, remove_before)

# All done
if not args.yes:


Loading…
Cancel
Save