diff options
author | Erik Johnston <erik@matrix.org> | 2018-02-14 13:37:56 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-02-15 09:51:09 +0000 |
commit | aece8e73b12ce481fc386fdcdcd8f6fa9ceaa2d9 (patch) | |
tree | 976b041f3d89c388bfeb109f94762f49c57601ed | |
parent | Deleting from event_push_actions needs to use an index (diff) | |
download | synapse-aece8e73b12ce481fc386fdcdcd8f6fa9ceaa2d9.tar.xz |
Make push actions rotation configurable
-rw-r--r-- | synapse/storage/event_push_actions.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py index 8efe2fd4bb..00a79fc5ac 100644 --- a/synapse/storage/event_push_actions.py +++ b/synapse/storage/event_push_actions.py @@ -87,6 +87,8 @@ class EventPushActionsStore(SQLBaseStore): self._rotate_notif_loop = self._clock.looping_call( self._rotate_notifs, 30 * 60 * 1000 ) + self._rotate_delay = 3 + self._rotate_count = 10000 def _set_push_actions_for_event_and_users_txn(self, txn, event, tuples): """ @@ -629,7 +631,7 @@ class EventPushActionsStore(SQLBaseStore): ) if caught_up: break - yield sleep(5) + yield sleep(self._rotate_delay) finally: self._doing_notif_rotation = False @@ -650,8 +652,8 @@ class EventPushActionsStore(SQLBaseStore): 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 |