mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 10:43:50 +01:00
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.
This commit is contained in:
parent
f749607c91
commit
026cd91ac8
1 changed files with 7 additions and 5 deletions
|
@ -18,6 +18,7 @@ import logging
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
|
from synapse.metrics.background_process_metrics import run_as_background_process
|
||||||
from synapse.push.pusher import PusherFactory
|
from synapse.push.pusher import PusherFactory
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -45,9 +46,13 @@ class PusherPool:
|
||||||
self.clock = self.hs.get_clock()
|
self.clock = self.hs.get_clock()
|
||||||
self.pushers = {}
|
self.pushers = {}
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def start(self):
|
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
|
@defer.inlineCallbacks
|
||||||
def add_pusher(self, user_id, access_token, kind, app_id,
|
def add_pusher(self, user_id, access_token, kind, app_id,
|
||||||
|
@ -192,9 +197,6 @@ class PusherPool:
|
||||||
Returns:
|
Returns:
|
||||||
Deferred
|
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()
|
pushers = yield self.store.get_all_pushers()
|
||||||
logger.info("Starting %d pushers", len(pushers))
|
logger.info("Starting %d pushers", len(pushers))
|
||||||
for pusherdict in pushers:
|
for pusherdict in pushers:
|
||||||
|
|
Loading…
Reference in a new issue