diff options
Diffstat (limited to 'client/src/leap/soledad/client/http_target/send.py')
-rw-r--r-- | client/src/leap/soledad/client/http_target/send.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/http_target/send.py b/client/src/leap/soledad/client/http_target/send.py index e8abf35b..3fc5a171 100644 --- a/client/src/leap/soledad/client/http_target/send.py +++ b/client/src/leap/soledad/client/http_target/send.py @@ -31,6 +31,12 @@ class HTTPDocSender(object): MAX_BATCH_SIZE = 0 # disabled by now, this is being tested yet + # The uuid of the local replica. + # Any class inheriting from this one should provide a meaningful attribute + # if the sync status event is meant to be used somewhere else. + + uuid = 'undefined' + @defer.inlineCallbacks def _send_docs(self, docs_by_generation, last_known_generation, last_known_trans_id, sync_id): @@ -71,7 +77,8 @@ class HTTPDocSender(object): result = yield self._send_request(body.pop()) if self._defer_encryption: self._delete_sent(sent) - _emit_send_status(body.consumed, total) + + _emit_send_status(self.uuid, body.consumed, total) defer.returnValue(result) def _send_request(self, body): @@ -112,9 +119,9 @@ class HTTPDocSender(object): return d -def _emit_send_status(idx, total): +def _emit_send_status(uuid, idx, total): content = {'sent': idx, 'total': total} - emit_async(SOLEDAD_SYNC_SEND_STATUS, content) + emit_async(SOLEDAD_SYNC_SEND_STATUS, uuid, content) msg = "%d/%d" % (idx, total) logger.debug("Sync send status: %s" % msg) |