summary refs log tree commit diff
path: root/synapse/storage/devices.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-07-25 09:41:12 +0100
committerRichard van der Hoff <richard@matrix.org>2018-07-25 09:41:12 +0100
commit371da42ae4ec093f3887e9485d149cdfbedd4e58 (patch)
treee065460fdf260a468eb4e7f224b89e0633d4a53d /synapse/storage/devices.py
parentMerge pull request #3597 from matrix-org/erikj/did_forget (diff)
downloadsynapse-371da42ae4ec093f3887e9485d149cdfbedd4e58.tar.xz
Wrap a number of things that run in the background
This will reduce the number of "Starting db connection from sentinel context"
warnings, and will help with our metrics.
Diffstat (limited to 'synapse/storage/devices.py')
-rw-r--r--synapse/storage/devices.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py
index cc3cdf2ebc..52dccb1507 100644
--- a/synapse/storage/devices.py
+++ b/synapse/storage/devices.py
@@ -21,6 +21,7 @@ from canonicaljson import json
 from twisted.internet import defer
 
 from synapse.api.errors import StoreError
+from synapse.metrics.background_process_metrics import run_as_background_process
 from synapse.util.caches.descriptors import cached, cachedInlineCallbacks, cachedList
 
 from ._base import Cache, SQLBaseStore
@@ -711,6 +712,9 @@ class DeviceStore(SQLBaseStore):
 
             logger.info("Pruned %d device list outbound pokes", txn.rowcount)
 
-        return self.runInteraction(
-            "_prune_old_outbound_device_pokes", _prune_txn
+        run_as_background_process(
+            "prune_old_outbound_device_pokes",
+            self.runInteraction,
+            "_prune_old_outbound_device_pokes",
+            _prune_txn,
         )