mirror of
https://github.com/element-hq/synapse.git
synced 2026-07-31 00:50:18 +00:00
Remove unnecessary select from _record_profile_updates_for_user_left_room_txn
This commit is contained in:
@@ -1042,30 +1042,21 @@ class ProfileWorkerStore(SQLBaseStore):
|
||||
users_to_update: The set of users who no longer share rooms with the user.
|
||||
"""
|
||||
# First clear the previous rows from the table
|
||||
txn.execute(
|
||||
"""
|
||||
SELECT stream_id FROM profile_updates
|
||||
WHERE user_id = ?
|
||||
""",
|
||||
(user_id.to_string(),),
|
||||
user_clause, user_args = make_in_list_sql_clause(
|
||||
txn.database_engine,
|
||||
"user_id",
|
||||
users_to_update,
|
||||
)
|
||||
txn.execute(
|
||||
f"""
|
||||
DELETE FROM profile_updates_per_user
|
||||
WHERE {user_clause}
|
||||
AND stream_id IN (
|
||||
SELECT stream_id FROM profile_updates WHERE user_id = ?
|
||||
)
|
||||
""",
|
||||
(*user_args, user_id.to_string()),
|
||||
)
|
||||
res = txn.fetchall()
|
||||
if res:
|
||||
user_clause, user_args = make_in_list_sql_clause(
|
||||
txn.database_engine,
|
||||
"user_id",
|
||||
users_to_update,
|
||||
)
|
||||
txn.execute(
|
||||
f"""
|
||||
DELETE FROM profile_updates_per_user
|
||||
WHERE {user_clause}
|
||||
AND stream_id IN (
|
||||
SELECT stream_id FROM profile_updates WHERE user_id = ?
|
||||
)
|
||||
""",
|
||||
(*user_args, user_id.to_string()),
|
||||
)
|
||||
|
||||
# Now record the "left room" action in the stream
|
||||
self._record_profile_updates_txn(
|
||||
|
||||
Reference in New Issue
Block a user