summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/leap/soledad/client/http_target/fetch.py4
-rw-r--r--client/src/leap/soledad/client/http_target/fetch_protocol.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/http_target/fetch.py b/client/src/leap/soledad/client/http_target/fetch.py
index 036b5b21..bbc743e1 100644
--- a/client/src/leap/soledad/client/http_target/fetch.py
+++ b/client/src/leap/soledad/client/http_target/fetch.py
@@ -97,7 +97,7 @@ class HTTPDocFetcher(object):
body_reader=body_reader)
@defer.inlineCallbacks
- def _doc_parser(self, doc_info, content):
+ def _doc_parser(self, doc_info, content, total):
"""
Insert a received document into the local replica.
@@ -127,7 +127,7 @@ class HTTPDocFetcher(object):
doc, doc_info['gen'], doc_info['trans_id'])
self._received_docs += 1
user_data = {'uuid': self.uuid, 'userid': self.userid}
- _emit_receive_status(user_data, self._received_docs, total=1000000)
+ _emit_receive_status(user_data, self._received_docs, total=total)
def _parse_metadata(self, metadata):
"""
diff --git a/client/src/leap/soledad/client/http_target/fetch_protocol.py b/client/src/leap/soledad/client/http_target/fetch_protocol.py
index 29801819..4290785d 100644
--- a/client/src/leap/soledad/client/http_target/fetch_protocol.py
+++ b/client/src/leap/soledad/client/http_target/fetch_protocol.py
@@ -113,11 +113,13 @@ class DocStreamReceiver(ReadBodyProtocol):
elif self._line == 1:
self.metadata = line
assert 'error' not in self.metadata
+ self.total = json.loads(line).get('number_of_changes', -1)
elif (self._line % 2) == 0:
self.current_doc = json.loads(line)
assert 'error' not in self.current_doc
else:
- self._doc_reader(self.current_doc, line.strip() or None)
+ self._doc_reader(
+ self.current_doc, line.strip() or None, self.total)
def finish(self):
"""