diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-10-22 16:12:11 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-10-22 16:12:11 +0100 |
commit | 026cd91ac878bc723f653f393fd1f44c438ba559 (patch) | |
tree | 53a12c1793ffcf76d679002316586eda8e06902d /synapse/push | |
parent | Make on_started synchronous too (diff) | |
download | synapse-026cd91ac878bc723f653f393fd1f44c438ba559.tar.xz |
Run PusherPool.start as a background process
We don't do anything with the result, so this is needed to give this code a logcontext.
Diffstat (limited to 'synapse/push')
-rw-r--r-- | synapse/push/pusherpool.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py index 695e582dce..d25877cc66 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py @@ -18,6 +18,7 @@ import logging from twisted.internet import defer +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.push.pusher import PusherFactory logger = logging.getLogger(__name__) @@ -45,9 +46,13 @@ class PusherPool: self.clock = self.hs.get_clock() self.pushers = {} - @defer.inlineCallbacks def start(self): - yield self._start_pushers() + """Starts the pushers off in a background process. + """ + if not self.start_pushers: + logger.info("Not starting pushers because they are disabled in the config") + return + run_as_background_process("start_pushers", self._start_pushers) @defer.inlineCallbacks def add_pusher(self, user_id, access_token, kind, app_id, @@ -192,9 +197,6 @@ class PusherPool: Returns: Deferred """ - if not self.start_pushers: - logger.info("Not starting pushers because they are disabled in the config") - return pushers = yield self.store.get_all_pushers() logger.info("Starting %d pushers", len(pushers)) for pusherdict in pushers: |