summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-14 13:37:56 +0000
committerRichard van der Hoff <richard@matrix.org>2018-06-22 14:44:37 +0100
commit75dc3ddeab645c280319581d252c078168348470 (patch)
tree3285caf7a9266ea7b6a3ee996984b7a214946ed1 /synapse
parentMerge pull request #3383 from matrix-org/rav/hacky_speedup_state_group_cache (diff)
downloadsynapse-75dc3ddeab645c280319581d252c078168348470.tar.xz
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