summaryrefslogtreecommitdiff
path: root/client/src/leap/soledad
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-09-29 11:19:16 -0300
committerdrebs <drebs@leap.se>2014-09-29 13:40:45 -0300
commit19f28c432f36022c5f1c0558f4742c864e7202c8 (patch)
tree0ff727462a387b7a634c2259894dfb1398b968a0 /client/src/leap/soledad
parent903ee560f26bec3ba9a7f01dcef3aaf0373515b4 (diff)
Wait for last post request to finish before starting a new one during sync (#5975).
Diffstat (limited to 'client/src/leap/soledad')
-rw-r--r--client/src/leap/soledad/client/target.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/leap/soledad/client/target.py b/client/src/leap/soledad/client/target.py
index ae2010a6..651d3ee5 100644
--- a/client/src/leap/soledad/client/target.py
+++ b/client/src/leap/soledad/client/target.py
@@ -1176,6 +1176,7 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth):
synced = []
number_of_docs = len(docs_by_generations)
+ last_request_lock = None
for doc, gen, trans_id in docs_by_generations:
# allow for interrupting the sync process
if self.stopped is True:
@@ -1212,7 +1213,7 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth):
# end of symmetric encryption
# -------------------------------------------------------------
t = syncer_pool.new_syncer_thread(
- sent + 1, total, last_request_lock=None,
+ sent + 1, total, last_request_lock=last_request_lock,
last_callback_lock=last_callback_lock)
# bail out if any thread failed
@@ -1249,7 +1250,12 @@ class SoledadSyncTarget(HTTPSyncTarget, TokenBasedAuth):
# save thread and append
t.start()
threads.append((t, doc))
+
+ # update lock references so they can be used in next call to
+ # syncer_pool.new_syncer_thread() above
last_callback_lock = t.callback_lock
+ last_request_lock = t.request_lock
+
sent += 1
# make sure all threads finished and we have up-to-date info