mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Make push actions rotation configurable
This commit is contained in:
parent
bb018d0b5b
commit
75dc3ddeab
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user