diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-08-06 17:35:41 -0300 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-08-11 11:50:29 -0400 |
commit | 541cd939aa3bfb8726f2e51d28ab3145059a676d (patch) | |
tree | 5b51d83c1c656466e7a4c7226fd6a4a0edf24357 | |
parent | cb92f58a141f410739ae6460b7eb8aaf2daa3c65 (diff) |
[feat] emit a dict instead of a str
-rw-r--r-- | client/changes/feature-improve-sync-status-info | 2 | ||||
-rw-r--r-- | client/src/leap/soledad/client/http_target.py | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/client/changes/feature-improve-sync-status-info b/client/changes/feature-improve-sync-status-info new file mode 100644 index 00000000..f563e375 --- /dev/null +++ b/client/changes/feature-improve-sync-status-info @@ -0,0 +1,2 @@ +- Improve how we send information on SOLEDAD_SYNC_SEND_STATUS and in + SOLEDAD_SYNC_RECEIVE_STATUS. Related to Feature #7353. diff --git a/client/src/leap/soledad/client/http_target.py b/client/src/leap/soledad/client/http_target.py index 31729e2c..19ebd82f 100644 --- a/client/src/leap/soledad/client/http_target.py +++ b/client/src/leap/soledad/client/http_target.py @@ -310,11 +310,12 @@ class SoledadHTTPSyncTarget(SyncTarget): if self._defer_encryption: self._sync_enc_pool.delete_encrypted_doc( doc.doc_id, doc.rev) + msg = "%d/%d" % (idx, total) - emit( - SOLEDAD_SYNC_SEND_STATUS, - "Soledad sync send status: %s" % msg) + content = {'sent': idx, 'total': total} + emit(SOLEDAD_SYNC_SEND_STATUS, content) logger.debug("Sync send status: %s" % msg) + response_dict = json.loads(result)[0] gen_after_send = response_dict['new_generation'] trans_id_after_send = response_dict['new_transaction_id'] @@ -506,7 +507,8 @@ class SoledadHTTPSyncTarget(SyncTarget): # ------------------------------------------------------------- self._received_docs += 1 msg = "%d/%d" % (self._received_docs, total) - emit(SOLEDAD_SYNC_RECEIVE_STATUS, msg) + content = {'received': self._received_docs, 'total': total} + emit(SOLEDAD_SYNC_RECEIVE_STATUS, content) logger.debug("Sync receive status: %s" % msg) return number_of_changes, new_generation, new_transaction_id |