summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/http/matrixfederationclient.py2
-rw-r--r--synapse/logging/context.py3
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`.