mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 20:02:16 -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
|
@ -833,7 +833,7 @@ class DeviceListUpdater:
|
|||
async def _handle_device_updates(self, user_id: str) -> None:
|
||||
"Actually handle pending updates."
|
||||
|
||||
with (await self._remote_edu_linearizer.queue(user_id)):
|
||||
async with self._remote_edu_linearizer.queue(user_id):
|
||||
pending_updates = self._pending_updates.pop(user_id, [])
|
||||
if not pending_updates:
|
||||
# This can happen since we batch updates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue