mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 10:34:57 -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
|
@ -451,7 +451,7 @@ class FederationSenderHandler:
|
|||
# service for robustness? Or could we replace it with an assertion that
|
||||
# we're not being re-entered?
|
||||
|
||||
with (await self._fed_position_linearizer.queue(None)):
|
||||
async with self._fed_position_linearizer.queue(None):
|
||||
# We persist and ack the same position, so we take a copy of it
|
||||
# here as otherwise it can get modified from underneath us.
|
||||
current_position = self.federation_position
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue