diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-09-22 05:03:59 -0300 |
---|---|---|
committer | Victor Shyba <victor1984@riseup.net> | 2016-11-18 15:55:52 -0300 |
commit | ec6ccbdeab1cba6534cb22ed247041b6da821884 (patch) | |
tree | 0f53f657f92f75c64a0b71c1f516fa5379e4dabf /common/src | |
parent | d774de2b603a63c61d297c402bea59908831a7e7 (diff) |
[feature] batch based on payload size
batch is slower than usual insert for a single doc, so, if a document
exceeds the buffer, commit the batch (if any) and put the huge load by
traditional insert.
refactor coming.
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/leap/soledad/common/couch/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/src/leap/soledad/common/couch/__init__.py b/common/src/leap/soledad/common/couch/__init__.py index 6f233b26..2e6f734e 100644 --- a/common/src/leap/soledad/common/couch/__init__.py +++ b/common/src/leap/soledad/common/couch/__init__.py @@ -791,7 +791,8 @@ class CouchDatabase(object): attachment['data'] = binascii.b2a_base64( parts[index]).strip() couch_doc['_attachments'] = attachments - gen_doc = self._allocate_new_generation(doc.doc_id, transaction_id, save=False) + gen_doc = self._allocate_new_generation( + doc.doc_id, transaction_id, save=False) self.batch_docs[doc.doc_id] = couch_doc self.batch_docs[gen_doc['_id']] = gen_doc last_gen, last_trans_id = self.batch_generation |