summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-04-07 17:22:14 +0100
committerDavid Baker <dave@matrix.org>2016-04-07 17:22:14 +0100
commit25cd5bb697996c1764c7746e4dfc1d8fffaaf8b2 (patch)
tree0be8721fe027de50eaad3011afdc4572924b2c08
parentAdd measure blocks (diff)
downloadsynapse-25cd5bb697996c1764c7746e4dfc1d8fffaaf8b2.tar.xz
defer.gatherResults rather than doing all the pokes in series
Diffstat (limited to '')
-rw-r--r--synapse/push/pusherpool.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index 7b1ce81e9a..8da444179c 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -123,10 +123,17 @@ class PusherPool:
             users_affected = yield self.store.get_push_action_users_in_range(
                 min_stream_id, max_stream_id
             )
+
+            deferreds = []
+
             for u in users_affected:
                 if u in self.pushers:
                     for p in self.pushers[u].values():
-                        yield p.on_new_notifications(min_stream_id, max_stream_id)
+                        deferreds.append(
+                            p.on_new_notifications(min_stream_id, max_stream_id)
+                        )
+
+            yield defer.gatherResults(deferreds)
         except:
             logger.exception("Exception in pusher on_new_notifications")
 
@@ -141,10 +148,17 @@ class PusherPool:
             )
             # This returns a tuple, user_id is at index 3
             users_affected = set([r[3] for r in updated_receipts])
+
+            deferreds = []
+
             for u in users_affected:
                 if u in self.pushers:
                     for p in self.pushers[u].values():
-                        yield p.on_new_receipts(min_stream_id, max_stream_id)
+                        deferreds.append(
+                                p.on_new_receipts(min_stream_id, max_stream_id)
+                        )
+
+            yield defer.gatherResults(deferreds)
         except:
             logger.exception("Exception in pusher on_new_receipts")