0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 15:43:52 +01:00

Merge pull request #3430 from matrix-org/rav/configurable_push_action_rotation

Make push actions rotation configurable
This commit is contained in:
Richard van der Hoff 2018-06-22 15:07:31 +01:00 committed by GitHub
commit 1d7ad11747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,8 @@ class EventPushActionsWorkerStore(SQLBaseStore):
self.find_stream_orderings_looping_call = self._clock.looping_call( self.find_stream_orderings_looping_call = self._clock.looping_call(
self._find_stream_orderings_for_times, 10 * 60 * 1000 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) @cachedInlineCallbacks(num_args=3, tree=True, max_entries=5000)
def get_unread_event_push_actions_by_room_for_user( def get_unread_event_push_actions_by_room_for_user(
@ -799,7 +801,7 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
) )
if caught_up: if caught_up:
break break
yield self.hs.get_clock().sleep(5) yield self.hs.get_clock().sleep(self._rotate_delay)
finally: finally:
self._doing_notif_rotation = False self._doing_notif_rotation = False
@ -820,8 +822,8 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
txn.execute(""" txn.execute("""
SELECT stream_ordering FROM event_push_actions SELECT stream_ordering FROM event_push_actions
WHERE stream_ordering > ? WHERE stream_ordering > ?
ORDER BY stream_ordering ASC LIMIT 1 OFFSET 50000 ORDER BY stream_ordering ASC LIMIT 1 OFFSET ?
""", (old_rotate_stream_ordering,)) """, (old_rotate_stream_ordering, self._rotate_count))
stream_row = txn.fetchone() stream_row = txn.fetchone()
if stream_row: if stream_row:
offset_stream_ordering, = stream_row offset_stream_ordering, = stream_row