mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-31 17:18:35 -04:00
Move the event storage into a single transaction
This commit is contained in:
parent
1379dcae6f
commit
4b2ad549d5
6 changed files with 60 additions and 48 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue