summaryrefslogtreecommitdiff
path: root/tools/merge_backup.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/merge_backup.py')
-rwxr-xr-xtools/merge_backup.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/merge_backup.py b/tools/merge_backup.py
index 41b1014..cadcec7 100755
--- a/tools/merge_backup.py
+++ b/tools/merge_backup.py
@@ -22,7 +22,7 @@ from mergetools import chunks, backup_sendlog, get_logorder, \
get_verifiedsize, get_missingentriesforbackup, \
hexencode, setverifiedsize, sendentries_merge, verifyroot, \
get_nfetched, parse_args, perm, waitforfile, flock_ex_or_fail, \
- Status, loginit
+ Status, loginit, start_worker
def backup_loop(nodename, nodeaddress, own_key, paths, verifiedsize, chunk):
for trynumber in range(5, 0, -1):
@@ -166,12 +166,11 @@ def merge_backup(args, config, localconfig, secondaries):
backupargs = (secondary, localconfig, chainsdb, logorder, s, timing)
if args.mergeinterval:
- pipe_mine, pipe_theirs = Pipe()
- p = Process(target=lambda pipe, argv: pipe.send(do_send(argv)),
- args=(pipe_theirs, backupargs),
- name='backup_%s' % nodename)
- p.start()
- procs[p] = (nodename, pipe_mine)
+ name = 'backup_%s' % nodename
+ p, pipe = start_worker(name,
+ lambda cpipe, argv: cpipe.send(do_send(argv)),
+ backupargs)
+ procs[p] = (nodename, pipe)
else:
root_hash = do_send(backupargs)
update_backupfile(mergedb, nodename, tree_size, root_hash)
@@ -233,7 +232,6 @@ def main():
create_ssl_context(cafile=paths["https_cacertfile"])
fetched_statinfo = waitforfile(fetched_path)
- retval = 0
while True:
failures = merge_backup(args, config, localconfig, nodes)
if not args.mergeinterval:
@@ -245,7 +243,7 @@ def main():
break
fetched_statinfo = stat(fetched_path)
- return retval
+ return 0
if __name__ == '__main__':
sys.exit(main())