summary refs log tree commit diff
path: root/synapse/push/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/push/__init__.py')
-rw-r--r--synapse/push/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 5fca3bd772..5fe8719fe7 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -30,7 +30,7 @@ class Pusher(object):
     MAX_BACKOFF = 60 * 60 * 1000
     GIVE_UP_AFTER = 24 * 60 * 60 * 1000
 
-    def __init__(self, _hs, user_name, app_id, app_instance_id,
+    def __init__(self, _hs, user_name, app_id,
                  app_display_name, device_display_name, pushkey, data,
                  last_token, last_success, failing_since):
         self.hs = _hs
@@ -39,7 +39,6 @@ class Pusher(object):
         self.clock = self.hs.get_clock()
         self.user_name = user_name
         self.app_id = app_id
-        self.app_instance_id = app_instance_id
         self.app_display_name = app_display_name
         self.device_display_name = device_display_name
         self.pushkey = pushkey
@@ -48,6 +47,7 @@ class Pusher(object):
         self.last_success = last_success  # not actually used
         self.backoff_delay = Pusher.INITIAL_BACKOFF
         self.failing_since = failing_since
+        self.alive = True
 
     @defer.inlineCallbacks
     def start(self):
@@ -65,7 +65,7 @@ class Pusher(object):
             logger.info("Pusher %s for user %s starting from token %s",
                         self.pushkey, self.user_name, self.last_token)
 
-        while True:
+        while self.alive:
             from_tok = StreamToken.from_string(self.last_token)
             config = PaginationConfig(from_token=from_tok, limit='1')
             chunk = yield self.evStreamHandler.get_stream(
@@ -81,6 +81,9 @@ class Pusher(object):
             if not single_event:
                 continue
 
+            if not self.alive:
+                continue
+
             ret = yield self.dispatch_push(single_event)
             if ret:
                 self.backoff_delay = Pusher.INITIAL_BACKOFF
@@ -142,6 +145,9 @@ class Pusher(object):
                     if self.backoff_delay > Pusher.MAX_BACKOFF:
                         self.backoff_delay = Pusher.MAX_BACKOFF
 
+    def stop(self):
+        self.alive = False
+
     def dispatch_push(self, p):
         pass