diff options
-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 |