mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-04 08:32:29 +00:00
purge: move room_depth update to end
... to avoid locking the table for too long
This commit is contained in:
parent
74fcbf741b
commit
39a6b35496
@ -2255,12 +2255,6 @@ class EventsStore(SQLBaseStore):
|
|||||||
event_id,
|
event_id,
|
||||||
))
|
))
|
||||||
|
|
||||||
logger.info("[purge] updating room_depth")
|
|
||||||
txn.execute(
|
|
||||||
"UPDATE room_depth SET min_depth = ? WHERE room_id = ?",
|
|
||||||
(topological_ordering, room_id,)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Delete all remote non-state events
|
# Delete all remote non-state events
|
||||||
for table in (
|
for table in (
|
||||||
"events",
|
"events",
|
||||||
@ -2298,6 +2292,18 @@ class EventsStore(SQLBaseStore):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# synapse tries to take out an exclusive lock on room_depth whenever it
|
||||||
|
# persists events (because upsert), and once we run this update, we
|
||||||
|
# will block that for the rest of our transaction.
|
||||||
|
#
|
||||||
|
# So, let's stick it at the end so that we don't block event
|
||||||
|
# persistence.
|
||||||
|
logger.info("[purge] updating room_depth")
|
||||||
|
txn.execute(
|
||||||
|
"UPDATE room_depth SET min_depth = ? WHERE room_id = ?",
|
||||||
|
(topological_ordering, room_id,)
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("[purge] done")
|
logger.info("[purge] done")
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
Loading…
Reference in New Issue
Block a user