summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-02-06 13:54:40 +0000
committerDavid Robertson <davidr@element.io>2023-02-06 13:55:08 +0000
commit665156fe88e5a475d3700fe0572ca04930711f21 (patch)
tree941087c66fd70baa8e48f3e397a387fd5b34e83a /synapse
parentMissing get_success-es (diff)
downloadsynapse-665156fe88e5a475d3700fe0572ca04930711f21.tar.xz
Ignore false positives from run_as_background_process
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/federation.py4
-rw-r--r--synapse/handlers/message.py2
-rw-r--r--synapse/metrics/background_process_metrics.py3
-rw-r--r--synapse/metrics/common_usage_metrics.py2
4 files changed, 7 insertions, 4 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 16057c030c..4e77bfa55e 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -192,7 +192,7 @@ class FederationHandler:
         # any partial-state-resync operations which were in flight when we
         # were shut down.
         if not hs.config.worker.worker_app:
-            run_as_background_process(
+            run_as_background_process(  # type: ignore[unused-awaitable]
                 "resume_sync_partial_state_room", self._resume_partial_state_room_sync
             )
 
@@ -1805,7 +1805,7 @@ class FederationHandler:
                             room_id=room_id,
                         )
 
-        run_as_background_process(
+        run_as_background_process(  # type: ignore[unused-awaitable]
             desc="sync_partial_state_room", func=_sync_partial_state_room_wrapper
         )
 
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 7dfebdc4aa..1c5fdca12a 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -1939,7 +1939,7 @@ class EventCreationHandler:
             if event.type == EventTypes.Message:
                 # We don't want to block sending messages on any presence code. This
                 # matters as sometimes presence code can take a while.
-                run_as_background_process(
+                run_as_background_process(  # type: ignore[unused-awaitable]
                     "bump_presence_active_time", self._bump_active_time, requester.user
                 )
 
diff --git a/synapse/metrics/background_process_metrics.py b/synapse/metrics/background_process_metrics.py
index 9ea4e23b31..ec6b95fdf3 100644
--- a/synapse/metrics/background_process_metrics.py
+++ b/synapse/metrics/background_process_metrics.py
@@ -207,6 +207,9 @@ def run_as_background_process(
     clock.looping_call and friends (or for firing-and-forgetting in the middle of a
     normal synapse async function).
 
+    Mypy will flag up this Deferred as unawaited. This is safe to ignore: the background
+    process runs automatically, even if we don't await the returned deferred.
+
     Args:
         desc: a description for this background process type
         func: a function, which may return a Deferred or a coroutine
diff --git a/synapse/metrics/common_usage_metrics.py b/synapse/metrics/common_usage_metrics.py
index 6e05b043d3..bb7c3122b8 100644
--- a/synapse/metrics/common_usage_metrics.py
+++ b/synapse/metrics/common_usage_metrics.py
@@ -54,7 +54,7 @@ class CommonUsageMetricsManager:
 
     async def setup(self) -> None:
         """Keep the gauges for common usage metrics up to date."""
-        run_as_background_process(
+        run_as_background_process(  # type: ignore[unused-awaitable]
             desc="common_usage_metrics_update_gauges", func=self._update_gauges
         )
         self._clock.looping_call(