diff options
author | drebs <drebs@leap.se> | 2015-07-23 18:03:39 -0300 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-07-27 10:03:30 -0400 |
commit | 8a18611fa4868b42999a48f728da5a9884d8cb62 (patch) | |
tree | 3ba072b52216a1c30f3eb53eb77f0ae7509cebf2 /client/src/leap/soledad | |
parent | f5a1f27fb2a2736ce285244a8142960f1caaf501 (diff) |
[bug] fix order of incoming document events
The incoming documents events are meant to be used by a progress bar for
soledad sync, yet to be implemented. When deferred decryption was used, the
events were sent out of order, depending on the order of arrival of the
documents. This commit changes it so that the content of the emited events are
in order, so it is meaningful for the implementation of a progress bar.
Note that even after documents are received from the server, they will still
be decrypted asynchronously, so another signal could be implemented to signal
for the waiting of the decryption of incoming documents.
Diffstat (limited to 'client/src/leap/soledad')
-rw-r--r-- | client/src/leap/soledad/client/http_target.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/client/src/leap/soledad/client/http_target.py b/client/src/leap/soledad/client/http_target.py index e586c7b5..9ed70568 100644 --- a/client/src/leap/soledad/client/http_target.py +++ b/client/src/leap/soledad/client/http_target.py @@ -395,6 +395,7 @@ class SoledadHTTPSyncTarget(SyncTarget): doc = yield self._receive_one_doc( headers, last_known_generation, last_known_trans_id, sync_id, 0) + self._received_docs = 0 number_of_changes, ngen, ntrans = self._insert_received_doc(doc, 1, 1) if defer_decryption: @@ -502,9 +503,10 @@ class SoledadHTTPSyncTarget(SyncTarget): # ------------------------------------------------------------- # end of symmetric decryption # ------------------------------------------------------------- - msg = "%d/%d" % (idx, total) + self._received_docs += 1 + msg = "%d/%d" % (self._received_docs, total) emit(SOLEDAD_SYNC_RECEIVE_STATUS, msg) - logger.debug("Soledad sync receive status: %s" % msg) + logger.debug("Sync receive status: %s" % msg) return number_of_changes, new_generation, new_transaction_id def _parse_received_doc_response(self, response): |