diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-09-17 04:26:08 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2016-12-12 09:11:58 -0200 |
commit | b774387754ecae77d3ae00de2a9e072cef2eb2e7 (patch) | |
tree | aa943104c82e3adf10bde31868820a31d7155062 /server | |
parent | 2f7dc19efc8b89820cb44ed8b0b9cb225555d446 (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')
-rw-r--r-- | server/src/leap/soledad/server/sync.py | 6 |
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), |