Change pushers to use the event_actions table#705
Conversation
… an event stream & running the rules again. Sytest passes, but remaining to do: * Make badges work again * Remove old, unused code
Also fix bugs with retrying.
| 'room_id': event['room_id'], | ||
| 'type': event['type'], | ||
| 'sender': event['user_id'], | ||
| 'id': event.event_id, # deprecated: remove soon |
There was a problem hiding this comment.
saying that the min stream id won't be completely accurate all the time
synapse/push/push_tools.py
Outdated
|
|
||
|
|
||
| @defer.inlineCallbacks | ||
| def get_badge_count(hs, user_id): |
There was a problem hiding this comment.
Given we only use hs.get_datastore(), it might be nice if this took a datastore instead?
synapse/storage/pusher.py
Outdated
| profile_tag=""): | ||
| def f(txn): | ||
| txn.call_after(self.get_users_with_pushers_in_room.invalidate_all) | ||
| with self._pushers_id_gen.get_next() as stream_id: |
There was a problem hiding this comment.
This should be done on the main thread (outside the txn)?
|
|
||
| @defer.inlineCallbacks | ||
| def _unsafe_process(self): | ||
| unprocessed = yield self.store.get_unread_push_actions_for_user_in_range( |
There was a problem hiding this comment.
Can you document what _unsafe_process does? Or at least what is unsafe about, what it assumes?
There was a problem hiding this comment.
Should _unsafe_process call itself if self.max_stream_ordering has been updated?
* If the event is an invite event, add the invitee to list of user we run push rules for (if they have a pusher etc) * Move invite_for_me to be higher prio than member events otherwise member events matches them * Spell override right
|
I've also fixed broken invite pushing and added a test for it: https://github.com/matrix-org/sytest/compare/dbkr/test_invites_pushed ptal |
| self.processing = True | ||
| yield self._unsafe_process() | ||
| finally: | ||
| self.processing = False |
There was a problem hiding this comment.
Do we want to check if max_stream_ordering has increased and if so call _unsafe_process again?
There was a problem hiding this comment.
I did this within _unsafe_process
and wrap unsafe process in a try block
|
LGTM |
Makes pushers no longer run as separate things that each listen on an event stream. They now have hooks that are called from points in message / receipt sending code where they go and query the event_push_actions table for new notifications.
This will completely eliminate the runtime used by the old style pushers, but done mostly to make way for doing email notifications in the same way.