mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 12:04:56 -04:00
Update delay_cancellation
to accept any awaitable (#12468)
This will mainly be useful when dealing with module callbacks, which are all typed as returning `Awaitable`s instead of coroutines or `Deferred`s. Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
b82fff66df
commit
a50fb411b3
4 changed files with 75 additions and 14 deletions
|
@ -41,7 +41,6 @@ from prometheus_client import Histogram
|
|||
from typing_extensions import Literal
|
||||
|
||||
from twisted.enterprise import adbapi
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.api.errors import StoreError
|
||||
from synapse.config.database import DatabaseConnectionConfig
|
||||
|
@ -794,7 +793,7 @@ class DatabasePool:
|
|||
# We also wait until everything above is done before releasing the
|
||||
# `CancelledError`, so that logging contexts won't get used after they have been
|
||||
# finished.
|
||||
return await delay_cancellation(defer.ensureDeferred(_runInteraction()))
|
||||
return await delay_cancellation(_runInteraction())
|
||||
|
||||
async def runWithConnection(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue