summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-08-26 14:31:48 +0100
committerMark Haines <mark.haines@matrix.org>2014-08-26 14:36:03 +0100
commit4b2ad549d5a1dcf5c05f890c0383626d6c042fd0 (patch)
tree8aec582555ff9c4551cfd50c3808ab6f313ac4bf /synapse/storage/_base.py
parentTake a snapshot of the state of the room before performing updates (diff)
downloadsynapse-4b2ad549d5a1dcf5c05f890c0383626d6c042fd0.tar.xz
Move the event storage into a single transaction
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 36cc57c1b8..cfbe85d798 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -86,16 +86,18 @@ class SQLBaseStore(object):
             table : string giving the table name
             values : dict of new column names and values for them
         """
+        return self._db_pool.runInteraction(
+            self._simple_insert_txn, table, values,
+        )
+
+    def _simple_insert_txn(self, txn, table, values):
         sql = "INSERT INTO %s (%s) VALUES(%s)" % (
             table,
             ", ".join(k for k in values),
             ", ".join("?" for k in values)
         )
-
-        def func(txn):
-            txn.execute(sql, values.values())
-            return txn.lastrowid
-        return self._db_pool.runInteraction(func)
+        txn.execute(sql, values.values())
+        return txn.lastrowid
 
     def _simple_select_one(self, table, keyvalues, retcols,
                            allow_none=False):