-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saying that the min stream id won't be completely accurate all the time
|
||
|
||
@defer.inlineCallbacks | ||
def get_badge_count(hs, user_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we only use hs.get_datastore()
, it might be nice if this took a datastore instead?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document what _unsafe_process
does? Or at least what is unsafe about, what it assumes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this within _unsafe_process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, so you did
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.