From b774387754ecae77d3ae00de2a9e072cef2eb2e7 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sat, 17 Sep 2016 04:26:08 -0300 Subject: [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. --- server/src/leap/soledad/server/sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server') 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), -- cgit v1.2.3