mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-09-16 18:24:33 -04:00
Add support for using executemany
This commit is contained in:
parent
1692dc019d
commit
43c2e8deae
5 changed files with 99 additions and 61 deletions
|
@ -262,18 +262,19 @@ class EventFederationStore(SQLBaseStore):
|
|||
For the given event, update the event edges table and forward and
|
||||
backward extremities tables.
|
||||
"""
|
||||
for e_id, _ in prev_events:
|
||||
# TODO (erikj): This could be done as a bulk insert
|
||||
self._simple_insert_txn(
|
||||
txn,
|
||||
self._simple_insert_many_txn(
|
||||
txn,
|
||||
table="event_edges",
|
||||
values={
|
||||
"event_id": event_id,
|
||||
"prev_event_id": e_id,
|
||||
"room_id": room_id,
|
||||
"is_state": False,
|
||||
},
|
||||
)
|
||||
values=[
|
||||
{
|
||||
"event_id": event_id,
|
||||
"prev_event_id": e_id,
|
||||
"room_id": room_id,
|
||||
"is_state": False,
|
||||
}
|
||||
for e_id, _ in prev_events
|
||||
],
|
||||
)
|
||||
|
||||
# Update the extremities table if this is not an outlier.
|
||||
if not outlier:
|
||||
|
@ -307,16 +308,17 @@ class EventFederationStore(SQLBaseStore):
|
|||
|
||||
# Insert all the prev_events as a backwards thing, they'll get
|
||||
# deleted in a second if they're incorrect anyway.
|
||||
for e_id, _ in prev_events:
|
||||
# TODO (erikj): This could be done as a bulk insert
|
||||
self._simple_insert_txn(
|
||||
txn,
|
||||
table="event_backward_extremities",
|
||||
values={
|
||||
self._simple_insert_many_txn(
|
||||
txn,
|
||||
table="event_backward_extremities",
|
||||
values=[
|
||||
{
|
||||
"event_id": e_id,
|
||||
"room_id": room_id,
|
||||
},
|
||||
)
|
||||
}
|
||||
for e_id, _ in prev_events
|
||||
],
|
||||
)
|
||||
|
||||
# Also delete from the backwards extremities table all ones that
|
||||
# reference events that we have already seen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue