From 8a18611fa4868b42999a48f728da5a9884d8cb62 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 23 Jul 2015 18:03:39 -0300 Subject: [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. --- client/changes/bug_fix-order-of-incoming-document-events | 1 + client/src/leap/soledad/client/http_target.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 client/changes/bug_fix-order-of-incoming-document-events diff --git a/client/changes/bug_fix-order-of-incoming-document-events b/client/changes/bug_fix-order-of-incoming-document-events new file mode 100644 index 00000000..0cdb5d3d --- /dev/null +++ b/client/changes/bug_fix-order-of-incoming-document-events @@ -0,0 +1 @@ + o Fix the order of the events emited for incoming documents. 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): -- cgit v1.2.3