summaryrefslogtreecommitdiff
path: root/common/src/leap
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-08-11 11:34:47 -0300
committerVictor Shyba <victor1984@riseup.net>2016-11-18 15:55:52 -0300
commit0056c6cea9742e62282a73e7e48f25b5e7d861ef (patch)
tree74030b5915a5b5829b81c5cc9d929bb6179d6f5f /common/src/leap
parent287b76da2ab43ac729d2d1fdef11ad82fd9b2b24 (diff)
[feature] use transactions on sync
We were using 1 transaction per doc, which is bad. Reference: http://stackoverflow.com/questions/1711631/improve-insert-per-second-performance-of-sqlite Code now uses 1 transaction for the whole sync.
Diffstat (limited to 'common/src/leap')
-rw-r--r--common/src/leap/soledad/common/l2db/backends/sqlite_backend.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/common/src/leap/soledad/common/l2db/backends/sqlite_backend.py b/common/src/leap/soledad/common/l2db/backends/sqlite_backend.py
index d73c0d16..295f3132 100644
--- a/common/src/leap/soledad/common/l2db/backends/sqlite_backend.py
+++ b/common/src/leap/soledad/common/l2db/backends/sqlite_backend.py
@@ -505,12 +505,11 @@ class SQLiteDatabase(CommonBackend):
def _put_doc_if_newer(self, doc, save_conflict, replica_uid=None,
replica_gen=None, replica_trans_id=None):
- with self._db_handle:
- return super(SQLiteDatabase, self)._put_doc_if_newer(
- doc,
- save_conflict=save_conflict,
- replica_uid=replica_uid, replica_gen=replica_gen,
- replica_trans_id=replica_trans_id)
+ return super(SQLiteDatabase, self)._put_doc_if_newer(
+ doc,
+ save_conflict=save_conflict,
+ replica_uid=replica_uid, replica_gen=replica_gen,
+ replica_trans_id=replica_trans_id)
def _add_conflict(self, c, doc_id, my_doc_rev, my_content):
c.execute("INSERT INTO conflicts VALUES (?, ?, ?)",