summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-06-22 15:07:31 +0100
committerGitHub <noreply@github.com>2018-06-22 15:07:31 +0100
commit1d7ad1174703c31abb3ceeb975a6f39ee990017d (patch)
treebc3a9dfbd2ef7ea90a29b9607720cc2d74d28df6 /synapse
parentMerge pull request #3431 from matrix-org/rav/erasure_visibility (diff)
parentMake push actions rotation configurable (diff)
downloadsynapse-1d7ad1174703c31abb3ceeb975a6f39ee990017d.tar.xz
Merge pull request #3430 from matrix-org/rav/configurable_push_action_rotation
Make push actions rotation configurable
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/event_push_actions.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index c4a0208ce4..8cb24b7d59 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -83,6 +83,8 @@ class EventPushActionsWorkerStore(SQLBaseStore):
         self.find_stream_orderings_looping_call = self._clock.looping_call(
             self._find_stream_orderings_for_times, 10 * 60 * 1000
         )
+        self._rotate_delay = 3
+        self._rotate_count = 10000
 
     @cachedInlineCallbacks(num_args=3, tree=True, max_entries=5000)
     def get_unread_event_push_actions_by_room_for_user(
@@ -799,7 +801,7 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
                 )
                 if caught_up:
                     break
-                yield self.hs.get_clock().sleep(5)
+                yield self.hs.get_clock().sleep(self._rotate_delay)
         finally:
             self._doing_notif_rotation = False
 
@@ -820,8 +822,8 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
         txn.execute("""
             SELECT stream_ordering FROM event_push_actions
             WHERE stream_ordering > ?
-            ORDER BY stream_ordering ASC LIMIT 1 OFFSET 50000
-        """, (old_rotate_stream_ordering,))
+            ORDER BY stream_ordering ASC LIMIT 1 OFFSET ?
+        """, (old_rotate_stream_ordering, self._rotate_count))
         stream_row = txn.fetchone()
         if stream_row:
             offset_stream_ordering, = stream_row