diff options
author | Erik Johnston <erik@matrix.org> | 2022-12-15 13:20:20 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2022-12-15 13:20:20 +0000 |
commit | 87406aa5d39a6fe8e9e6fff45e2fcbefa0d5d44e (patch) | |
tree | 93465a7bcf77adb01ebdea0c571e641ec34ba0f8 | |
parent | Fixup (diff) | |
download | synapse-87406aa5d39a6fe8e9e6fff45e2fcbefa0d5d44e.tar.xz |
Fixup
-rw-r--r-- | synapse/http/matrixfederationclient.py | 2 | ||||
-rw-r--r-- | synapse/logging/context.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 88b1c22802..1ad9f5acac 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -645,7 +645,7 @@ class MatrixFederationHttpClient: headers_dict, data, ) - response = await defer.Deferred.fromFuture(response_d) + response = await make_deferred_yieldable(response_d) except DNSLookupError as e: raise RequestSendFailed(e, can_retry=retry_on_dns_fail) from e except Exception as e: diff --git a/synapse/logging/context.py b/synapse/logging/context.py index f62bea968f..a577040dad 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -26,6 +26,7 @@ import logging import threading import typing import warnings +from asyncio import Future from types import TracebackType from typing import ( TYPE_CHECKING, @@ -814,6 +815,8 @@ def run_in_background( # type: ignore[misc] res = defer.ensureDeferred(res) elif isinstance(res, defer.Deferred): pass + elif isinstance(res, Future): + res = defer.Deferred.fromFuture(res) elif isinstance(res, Awaitable): # `res` is probably some kind of completed awaitable, such as a `DoneAwaitable` # or `Future` from `make_awaitable`. |