diff options
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 17f9d27289..ba180da56d 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -129,7 +129,7 @@ class EventsStore(SQLBaseStore): "room_id": s.room_id, "type": s.type, "state_key": s.state_key, - }, + } ) if event.is_state() and is_new_state: @@ -306,16 +306,18 @@ class EventsStore(SQLBaseStore): hash_bytes ) - for auth_id, _ in event.auth_events: - self._simple_insert_txn( - txn, - table="event_auth", - values={ + self._simple_insert_many_txn( + txn, + table="event_auth", + values=[ + { "event_id": event.event_id, "room_id": event.room_id, "auth_id": auth_id, - }, - ) + } + for auth_id, _ in event.auth_events + ], + ) (ref_alg, ref_hash_bytes) = compute_event_reference_hash(event) self._store_event_reference_hash_txn( @@ -340,17 +342,19 @@ class EventsStore(SQLBaseStore): vals, ) - for e_id, h in event.prev_state: - self._simple_insert_txn( - txn, - table="event_edges", - values={ + self._simple_insert_many_txn( + txn, + table="event_edges", + values=[ + { "event_id": event.event_id, "prev_event_id": e_id, "room_id": event.room_id, "is_state": True, - }, - ) + } + for e_id, h in event.prev_state + ], + ) if is_new_state and not context.rejected: self._simple_upsert_txn( |