mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-27 22:35:20 -04:00
Refactor and convert Linearizer
to async (#12357)
Refactor and convert `Linearizer` to async. This makes a `Linearizer` cancellation bug easier to fix. Also refactor to use an async context manager, which eliminates an unlikely footgun where code that doesn't immediately use the context manager could forget to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
ab3fdcf960
commit
800ba87cc8
21 changed files with 104 additions and 115 deletions
|
@ -888,7 +888,7 @@ class RoomMemberWorkerStore(EventsWorkerStore):
|
|||
return frozenset(cache.hosts_to_joined_users)
|
||||
|
||||
# Since we'll mutate the cache we need to lock.
|
||||
with (await self._joined_host_linearizer.queue(room_id)):
|
||||
async with self._joined_host_linearizer.queue(room_id):
|
||||
if state_entry.state_group == cache.state_group:
|
||||
# Same state group, so nothing to do. We've already checked for
|
||||
# this above, but the cache may have changed while waiting on
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue