summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-10-22 16:12:11 +0100
committerRichard van der Hoff <richard@matrix.org>2018-10-22 16:12:11 +0100
commit5110f4e4258564615edfca6112ab6a36eb551672 (patch)
treee376f4271cb382d30a6570b3a4b3eff64c9bc6ae
parentFactor PusherPool._start_pusher out of _start_pushers (diff)
downloadsynapse-5110f4e4258564615edfca6112ab6a36eb551672.tar.xz
move get_all_pushers call down
simplifies the interface to _start_pushers
-rw-r--r--synapse/push/pusherpool.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index a5c133aa33..b9b68ec829 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -36,8 +36,7 @@ class PusherPool:
 
     @defer.inlineCallbacks
     def start(self):
-        pushers = yield self.store.get_all_pushers()
-        self._start_pushers(pushers)
+        yield self._start_pushers()
 
     @defer.inlineCallbacks
     def add_pusher(self, user_id, access_token, kind, app_id,
@@ -207,10 +206,17 @@ class PusherPool:
         if p:
             self._start_pusher(p)
 
-    def _start_pushers(self, pushers):
+    @defer.inlineCallbacks
+    def _start_pushers(self):
+        """Start all the pushers
+
+        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:
             self._start_pusher(pusherdict)