Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
[feat] emit a dict instead of a str
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanalejandro0 authored and kalikaneko committed Aug 11, 2015
1 parent cb92f58 commit 541cd93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions client/changes/feature-improve-sync-status-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Improve how we send information on SOLEDAD_SYNC_SEND_STATUS and in
SOLEDAD_SYNC_RECEIVE_STATUS. Related to Feature #7353.
10 changes: 6 additions & 4 deletions client/src/leap/soledad/client/http_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,12 @@ def _send_docs(self, docs_by_generation, last_known_generation,
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']
Expand Down Expand Up @@ -506,7 +507,8 @@ def _insert_received_doc(self, response, idx, total):
# -------------------------------------------------------------
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

Expand Down

0 comments on commit 541cd93

Please sign in to comment.