summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-01-20 13:49:00 +0000
committerDavid Baker <dave@matrix.org>2016-01-20 13:49:00 +0000
commitd7265977376eb391007cde55c4b2d9b8f54d452b (patch)
treecd14ea93e979e0e0336eb51096a886403e05a266 /synapse
parentMerge branch 'develop' into push_badge_counts (diff)
downloadsynapse-d7265977376eb391007cde55c4b2d9b8f54d452b.tar.xz
Simplify badge updating code by just updating it every time we get woken up and it's not an event
Diffstat (limited to 'synapse')
-rw-r--r--synapse/push/__init__.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 46c453b6c0..438341b518 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -126,6 +126,9 @@ class Pusher(object):
         from_tok = StreamToken.from_string(self.last_token)
         config = PaginationConfig(from_token=from_tok, limit='1')
         timeout = (300 + random.randint(-60, 60)) * 1000
+        # note that we need to get read receipts down the stream as we need to
+        # wake up when one arrives. we don't need to explicitly look for
+        # them though.
         chunk = yield self.evStreamHandler.get_stream(
             self.user_id, config, timeout=timeout, affect_presence=False
         )
@@ -133,23 +136,12 @@ class Pusher(object):
         # limiting to 1 may get 1 event plus 1 presence event, so
         # pick out the actual event
         single_event = None
-        read_receipt = None
         for c in chunk['chunk']:
             if 'event_id' in c:  # Hmmm...
                 single_event = c
-            elif c['type'] == 'm.receipt':
-                read_receipt = c
-
-        have_updated_badge = False
-        if read_receipt:
-            for receipt_part in read_receipt['content'].values():
-                if 'm.read' in receipt_part:
-                    if self.user_id in receipt_part['m.read'].keys():
-                        have_updated_badge = True
 
         if not single_event:
-            if have_updated_badge:
-                yield self.update_badge()
+            yield self.update_badge()
             self.last_token = chunk['end']
             yield self.store.update_pusher_last_token(
                 self.app_id,
@@ -194,9 +186,6 @@ class Pusher(object):
                         yield self.hs.get_pusherpool().remove_pusher(
                             self.app_id, pk, self.user_id
                         )
-        else:
-            if have_updated_badge:
-                yield self.update_badge()
             processed = True
 
         if not self.alive: