diff options
author | Linus Nordberg <linus@nordu.net> | 2016-11-28 00:34:41 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-11-28 00:34:41 +0100 |
commit | 47a638cf4166dd3be929d8572fef171ce09d428b (patch) | |
tree | 6468adca5eff3ae84f1de1e7d9e814d0c151ad98 /tools/merge_backup.py | |
parent | 2b6eded0d3c39b0b3c886577e5755b169faab233 (diff) |
If any backup process failed, try again.
Try again without waiting for an update of the fetched file, which
won't happen in the tests (but probably will happen in real life,
masking this bug).
Diffstat (limited to 'tools/merge_backup.py')
-rwxr-xr-x | tools/merge_backup.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/merge_backup.py b/tools/merge_backup.py index 56b5b57..12ff99d 100755 --- a/tools/merge_backup.py +++ b/tools/merge_backup.py @@ -155,6 +155,7 @@ def update_backupfile(mergedb, nodename, tree_size, root_hash): write_file(backuppath, backupdata) def merge_backup(args, config, localconfig, secondaries): + failures = 0 paths = localconfig["paths"] mergedb = paths["mergedb"] chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains") @@ -200,6 +201,7 @@ def merge_backup(args, config, localconfig, secondaries): update_backupfile(mergedb, nodename, tree_size, root_hash) else: logging.warning("%s failure: %d", nodename, p.exitcode) + failures += 1 del procs[p] if not procs: break @@ -207,7 +209,7 @@ def merge_backup(args, config, localconfig, secondaries): if args.timing: logging.debug("timing: merge_backup: %s", timing["deltatimes"]) - return 0 + return failures def main(): """ @@ -247,12 +249,14 @@ def main(): fetched_statinfo = waitforfile(fetched_path) retval = 0 while True: - retval = merge_backup(args, config, localconfig, nodes) - if retval or not args.mergeinterval: + failures = merge_backup(args, config, localconfig, nodes) + if not args.mergeinterval: break fetched_statinfo_old = fetched_statinfo while fetched_statinfo == fetched_statinfo_old: sleep(max(3, args.mergeinterval / 10)) + if failures > 0: + break fetched_statinfo = stat(fetched_path) return retval |