From 93c853234ced6564b6d7158c47e0804569113f04 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 3 Aug 2015 11:31:04 -0300 Subject: [feat] allow repeated sync in client db script --- scripts/db_access/client_side_db.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts/db_access') diff --git a/scripts/db_access/client_side_db.py b/scripts/db_access/client_side_db.py index f43b2f14..422afffa 100644 --- a/scripts/db_access/client_side_db.py +++ b/scripts/db_access/client_side_db.py @@ -172,6 +172,9 @@ def _parse_args(): parser.add_argument( '--sync', '-s', action='store_true', help='synchronize with the server replica') + parser.add_argument( + '--repeat-sync', '-r', action='store_true', + help='repeat synchronization until no new data is received') parser.add_argument( '--export-public-key', help="export the public key to a file") parser.add_argument( @@ -251,6 +254,12 @@ def _main(soledad, km, args): yield soledad.create_doc(content) if args.sync: yield soledad.sync() + if args.repeat_sync: + old_gen = 0 + new_gen = yield soledad.sync() + while old_gen != new_gen: + old_gen = new_gen + new_gen = yield soledad.sync() if args.get_all_docs: yield _get_all_docs(soledad) if args.export_private_key: -- cgit v1.2.3