summaryrefslogtreecommitdiff
path: root/server/src/leap
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-09-17 04:26:08 -0300
committerVictor Shyba <victor1984@riseup.net>2016-11-18 15:55:52 -0300
commit9b7623637439ce09ee8dbf8c8f4fb19f6c51b396 (patch)
tree0247b0072907418e660772e557e89c7fbc6ddeb0 /server/src/leap
parent0c17692f7fc110f7fc9467d4537b24849d2bdb95 (diff)
[feature] make reading attachments optional
Will put a file object on doc json string if read_content is False, otherwise it will fetch and fill as usual. This is useful for improving server througput on sync download stream by receiving a bulk-get without attachments and consume the file-objects as they come.
Diffstat (limited to 'server/src/leap')
-rw-r--r--server/src/leap/soledad/server/sync.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py
index 77d4b840..6f2ffe9f 100644
--- a/server/src/leap/soledad/server/sync.py
+++ b/server/src/leap/soledad/server/sync.py
@@ -102,10 +102,12 @@ class SyncExchange(sync.SyncExchange):
:return: None
"""
changes_to_return = self.changes_to_return
- # return docs, including conflicts
+ # return docs, including conflicts.
+ # content as a file-object (will be read when writing)
changed_doc_ids = [doc_id for doc_id, _, _ in changes_to_return]
docs = self._db.get_docs(
- changed_doc_ids, check_for_conflicts=False, include_deleted=True)
+ changed_doc_ids, check_for_conflicts=False,
+ include_deleted=True, read_content=False)
docs_by_gen = izip(
docs, (gen for _, gen, _ in changes_to_return),