diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-01-13 19:44:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 19:44:18 -0500 |
commit | 3e0536cd2afb5a640619bd872fc27b068ec3eb9b (patch) | |
tree | c365064c215542412bc86561995b44fffe598565 /synapse/storage/databases/main/presence.py | |
parent | Fix missing app variable in mail subject (#11745) (diff) | |
download | synapse-3e0536cd2afb5a640619bd872fc27b068ec3eb9b.tar.xz |
Replace uses of simple_insert_many with simple_insert_many_values. (#11742)
This should be (slightly) more efficient and it is simpler to have a single method for inserting multiple values.
Diffstat (limited to 'synapse/storage/databases/main/presence.py')
-rw-r--r-- | synapse/storage/databases/main/presence.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/synapse/storage/databases/main/presence.py b/synapse/storage/databases/main/presence.py index cbf9ec38f7..4f05811a77 100644 --- a/synapse/storage/databases/main/presence.py +++ b/synapse/storage/databases/main/presence.py @@ -129,18 +129,29 @@ class PresenceStore(PresenceBackgroundUpdateStore): self.db_pool.simple_insert_many_txn( txn, table="presence_stream", + keys=( + "stream_id", + "user_id", + "state", + "last_active_ts", + "last_federation_update_ts", + "last_user_sync_ts", + "status_msg", + "currently_active", + "instance_name", + ), values=[ - { - "stream_id": stream_id, - "user_id": state.user_id, - "state": state.state, - "last_active_ts": state.last_active_ts, - "last_federation_update_ts": state.last_federation_update_ts, - "last_user_sync_ts": state.last_user_sync_ts, - "status_msg": state.status_msg, - "currently_active": state.currently_active, - "instance_name": self._instance_name, - } + ( + stream_id, + state.user_id, + state.state, + state.last_active_ts, + state.last_federation_update_ts, + state.last_user_sync_ts, + state.status_msg, + state.currently_active, + self._instance_name, + ) for stream_id, state in zip(stream_orderings, presence_states) ], ) |