mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
Optimise the event_push_backfill_thread_id bg job (#14172)
Co-authored-by: Erik Johnston <erik@matrix.org>
This commit is contained in:
parent
821f74a8c0
commit
16c5d95b59
2 changed files with 9 additions and 2 deletions
1
changelog.d/14172.bugfix
Normal file
1
changelog.d/14172.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix poor performance of the `event_push_backfill_thread_id` background update, which was introduced in Synapse 1.68.0rc1.
|
|
@ -297,9 +297,15 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
|
||||||
sql = f"""
|
sql = f"""
|
||||||
UPDATE {table_name}
|
UPDATE {table_name}
|
||||||
SET thread_id = 'main'
|
SET thread_id = 'main'
|
||||||
WHERE stream_ordering <= ? AND thread_id IS NULL
|
WHERE ? < stream_ordering AND stream_ordering <= ? AND thread_id IS NULL
|
||||||
"""
|
"""
|
||||||
txn.execute(sql, (max_stream_ordering,))
|
txn.execute(
|
||||||
|
sql,
|
||||||
|
(
|
||||||
|
start_stream_ordering,
|
||||||
|
max_stream_ordering,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
# Update progress.
|
# Update progress.
|
||||||
processed_rows = txn.rowcount
|
processed_rows = txn.rowcount
|
||||||
|
|
Loading…
Reference in a new issue