mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 10:05:55 +03:00
Don't needlessly enter transaction
This commit is contained in:
parent
56b5e83e36
commit
1d275dba69
1 changed files with 9 additions and 9 deletions
|
@ -159,10 +159,8 @@ class TransactionStore(SQLBaseStore):
|
||||||
|
|
||||||
self.inflight_transactions.setdefault(destination, {})[transaction_id] = txn_row
|
self.inflight_transactions.setdefault(destination, {})[transaction_id] = txn_row
|
||||||
|
|
||||||
# TODO: Fetch prev_txns
|
|
||||||
|
|
||||||
return self.runInteraction(
|
return self.runInteraction(
|
||||||
"prep_send_transaction",
|
"_get_prevs_txn",
|
||||||
self._get_prevs_txn,
|
self._get_prevs_txn,
|
||||||
destination,
|
destination,
|
||||||
)
|
)
|
||||||
|
@ -350,11 +348,12 @@ class TransactionStore(SQLBaseStore):
|
||||||
]
|
]
|
||||||
|
|
||||||
def f(txn):
|
def f(txn):
|
||||||
self._simple_insert_many_txn(
|
if full_rows:
|
||||||
txn=txn,
|
self._simple_insert_many_txn(
|
||||||
table="sent_transactions",
|
txn=txn,
|
||||||
values=full_rows
|
table="sent_transactions",
|
||||||
)
|
values=full_rows
|
||||||
|
)
|
||||||
|
|
||||||
for dest, txn_map in update_delivered.items():
|
for dest, txn_map in update_delivered.items():
|
||||||
for txn_id, update_row in txn_map.items():
|
for txn_id, update_row in txn_map.items():
|
||||||
|
@ -371,6 +370,7 @@ class TransactionStore(SQLBaseStore):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.runInteraction("_persist_in_mem_txns", f)
|
if full_rows or update_delivered:
|
||||||
|
yield self.runInteraction("_persist_in_mem_txns", f)
|
||||||
except:
|
except:
|
||||||
logger.exception("Failed to persist transactions!")
|
logger.exception("Failed to persist transactions!")
|
||||||
|
|
Loading…
Reference in a new issue