diff options
-rwxr-xr-x | tools/merge_backup.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/merge_backup.py b/tools/merge_backup.py index 12ff99d..41b1014 100755 --- a/tools/merge_backup.py +++ b/tools/merge_backup.py @@ -99,7 +99,7 @@ def check_root(logorder, nodename, nodeaddress, own_key, paths, tree_size, timin timing_point(timing, "verifyroot") return root_hash -def do_it(backupargs): +def do_send(backupargs): secondary, localconfig, chainsdb, logorder, s, timing = backupargs maxwindow = localconfig.get("maxwindow", 1000) paths = localconfig["paths"] @@ -133,20 +133,6 @@ def do_it(backupargs): setverifiedsize(nodename, nodeaddress, own_key, paths, verifiedsize) return root_hash -def worker(pipe, backupargs): - root_hash = do_it(backupargs) - pipe.send(root_hash) - return 0 - -def start_worker(backupargs): - _, _, _, nodename, _, _, _, _, _, _, _ = backupargs - parent_conn, child_conn = Pipe() - p = Process(target=worker, - args=(child_conn, backupargs), - name='backup_%s' % nodename) - p.start() - return p, parent_conn - def update_backupfile(mergedb, nodename, tree_size, root_hash): backuppath = mergedb + "/verified." + nodename backupdata = {"tree_size": tree_size, @@ -181,13 +167,13 @@ 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=worker, + 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) else: - root_hash = do_it(backupargs) + root_hash = do_send(backupargs) update_backupfile(mergedb, nodename, tree_size, root_hash) if args.mergeinterval: |