Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change pushers to use the event_actions table #705

Merged
merged 22 commits into from
Apr 11, 2016

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Apr 7, 2016

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.

'room_id': event['room_id'],
'type': event['type'],
'sender': event['user_id'],
'id': event.event_id, # deprecated: remove soon
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbkr added 2 commits April 7, 2016 17:09
saying that the min stream id won't be completely accurate all the time


@defer.inlineCallbacks
def get_badge_count(hs, user_id):
Copy link
Member

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:
Copy link
Member

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(
Copy link
Member

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?

Copy link
Member

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?

dbkr added 2 commits April 8, 2016 14:08
 * 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
@dbkr
Copy link
Member Author

dbkr commented Apr 8, 2016

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
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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
@erikjohnston
Copy link
Member

LGTM

@dbkr dbkr merged commit 2547dff into develop Apr 11, 2016
@richvdh richvdh deleted the dbkr/pushers_use_event_actions branch December 1, 2016 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants