David Baker
e2a01455af
Add single instance & logging stuff
...
Copy the stuff over from http pusher that prevents multiple instances of process running at once and sets up logging and measure blocks.
2016-04-19 14:52:58 +01:00
David Baker
07d765209d
First bits of emailpusher
...
Mostly logic of when to send an email
2016-04-19 14:24:36 +01:00
Erik Johnston
9ae64c9910
Measure push action generator
2016-04-14 13:42:22 +01:00
Erik Johnston
b42ad359e9
Merge pull request #725 from matrix-org/dbkr/push_only_joined
...
Don't push for everyone who ever sent an RR to the room
2016-04-14 12:05:13 +01:00
David Baker
757e2c79b4
Don't push for everyone who ever sent an RR to the room
2016-04-14 12:02:50 +01:00
Erik Johnston
86e9bbc74e
Add missing yield
2016-04-14 11:56:52 +01:00
Erik Johnston
e40f25ebe1
Rename log context
2016-04-14 11:54:14 +01:00
Erik Johnston
2ae91a9e2f
Make send_badge private
2016-04-14 11:37:50 +01:00
Erik Johnston
56da835eaf
Add necessary logging contexts
2016-04-14 11:33:50 +01:00
Erik Johnston
7be1065b8f
Add extra Measure
2016-04-14 11:26:15 +01:00
David Baker
65141161f6
Unused member variable
2016-04-12 16:25:26 +01:00
Mark Haines
790f5848b2
Fix the rule_id for .m.rule.invite_for_me ( #715 )
2016-04-11 16:10:39 +01:00
David Baker
9bb041791c
Run unsafe proces in a loop until we've caught up
...
and wrap unsafe process in a try block
2016-04-11 12:48:30 +01:00
David Baker
d96a070a3a
Actually check if we;re processing
2016-04-08 16:49:39 +01:00
David Baker
ed3979df5f
Fix invite pushes
...
* 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
2016-04-08 15:29:59 +01:00
David Baker
7b6d519482
Make sure max stream ordering only increases
2016-04-08 14:08:16 +01:00
David Baker
52d1008661
Unsafe process should call itself if the max has changed
2016-04-08 14:06:54 +01:00
David Baker
ce3fe52498
Comment why unsafe process is unsafe
2016-04-08 14:02:38 +01:00
David Baker
a4a31fa8dc
Only pass in what we need
2016-04-07 17:37:19 +01:00
David Baker
15e0f1696f
Wrap process in a flag so we don't process whist already processing.
2016-04-07 17:31:08 +01:00
David Baker
6ec02e9ecf
indenting
2016-04-07 17:24:05 +01:00
David Baker
25cd5bb697
defer.gatherResults rather than doing all the pokes in series
2016-04-07 17:22:14 +01:00
David Baker
fa129ce5b5
Add measure blocks
2016-04-07 17:12:29 +01:00
David Baker
e1e042f2a1
Add comments on min_stream_id
...
saying that the min stream id won't be completely accurate all the time
2016-04-07 17:09:36 +01:00
David Baker
d549fdfa22
Remove code that's now been obsoleted or moved elsewhere
2016-04-07 16:31:38 +01:00
David Baker
92e3071623
Send badge count pushes.
...
Also fix bugs with retrying.
2016-04-07 15:39:53 +01:00
David Baker
7e2c89a37f
Make pushers use the event_push_actions table instead of listening on an event stream & running the rules again. Sytest passes, but remaining to do:
...
* Make badges work again
* Remove old, unused code
2016-04-06 15:42:15 +01:00
Mark Haines
2a37467fa1
Use google style doc strings.
...
pycharm supports them so there is no need to use the other format.
Might as well convert the existing strings to reduce the risk of
people accidentally cargo culting the wrong doc string format.
2016-04-01 16:12:07 +01:00
David Baker
c27c51484a
Don't ignore the obey overlay if the rule has an enabled attribute of False
...
Fixes https://github.com/vector-im/vector-web/issues/1244
2016-03-31 10:12:31 +01:00
David Baker
3b554bda26
Never notify for member events. This fixes https://github.com/vector-im/vector-web/issues/828
2016-03-24 13:19:39 +00:00
Erik Johnston
b6507869cd
Make get_invites return RoomsForUser
2016-03-23 10:32:10 +00:00
Mark Haines
5defb25ac6
Use get_users_in_room to count the number of room members rather than using read_receipts
2016-03-22 13:52:45 +00:00
David Baker
af59826a2f
Make select more sensible when dseleting access tokens, rename pusher deletion to match access token deletion and make exception arg optional.
2016-03-11 14:34:09 +00:00
David Baker
aa11db5f11
Fix cache invalidation so deleting access tokens (which we did when changing password) actually takes effect without HS restart. Reinstate the code to avoid logging out the session that changed the password, removed in 415c2f0549
2016-03-11 13:14:18 +00:00
Mark Haines
7076082ae6
Fix relative imports so they work in both py3 and py27
2016-03-08 11:45:50 +00:00
Mark Haines
3406eba4ef
Move the code for formatting push rules into a separate function
2016-03-03 16:11:59 +00:00
Mark Haines
de27f7fc79
Add support for changing the actions for default rules
...
See matrix-org/matrix-doc#283
Works by adding dummy rules to the push rules table with a negative priority class and then using those rules to clobber the default rule actions when adding the default rules in ``list_with_base_rules``
2016-02-26 14:28:19 +00:00
Richard van der Hoff
05aee12652
Merge branch 'develop' into rav/guest_access_after_room_join
2016-02-19 12:00:16 +00:00
Richard van der Hoff
b71ca2b014
Allow guest users access to messages in rooms they have joined
...
There should be no difference between guest users and non-guest users in terms
of access to messages. Define the semantics of the is_peeking argument to
filter_events_for_clients (slightly) better; interpret it appropriately, and
set it correctly from /sync.
2016-02-19 11:41:02 +00:00
Mark Haines
b9977ea667
Remove dead code for setting device specific rules.
...
It wasn't possible to hit the code from the API because of a typo
in parsing the request path. Since no-one was using the feature
we might as well remove the dead code.
2016-02-18 16:05:13 +00:00
Erik Johnston
7b0d846407
Atomically persit push actions when we persist the event
2016-02-09 16:19:15 +00:00
Erik Johnston
f28cc45183
Pass in current state to push action handler
2016-02-09 16:01:40 +00:00
Erik Johnston
31a2b892d8
Revert to putting it around the entire block
2016-02-09 11:25:09 +00:00
Erik Johnston
549698b1e0
Don't measure across event stream call, as it lasts for a long time.
2016-02-09 09:37:09 +00:00
Erik Johnston
2c1fbea531
Fix up logcontexts
2016-02-08 14:26:45 +00:00
Erik Johnston
13e6262659
Add metrics to pushers
2016-02-08 14:26:45 +00:00
Erik Johnston
771528ab13
Change event_push_actions_rm_tokens schema
2016-02-03 10:50:49 +00:00
Daniel Wagner-Hall
d83d004ccd
Fix flake8 warnings for new flake8
2016-02-02 17:18:50 +00:00
David Baker
766c24b2e6
Only notify for messages in one to one rooms, not every event
...
Fixes the fact that candidate events and hangups generated notifications.
2016-01-26 10:21:41 +00:00
Erik Johnston
53cb173663
Push: Use storage apis that are cached
2016-01-25 13:55:18 +00:00
David Baker
f92fe15897
Merge pull request #523 from matrix-org/dbkr/no_push_unless_notify
...
Better fix for actions with both dont_notify and tweaks
2016-01-22 17:27:25 +00:00
David Baker
3fe8c56736
Better fix for actions with both dont_notify and tweaks
2016-01-22 17:21:58 +00:00
David Baker
60965bd7e5
Revert b4a41aa542
as it's just broken.
2016-01-22 17:21:15 +00:00
David Baker
0e0e441b33
Merge pull request #522 from matrix-org/dbkr/no_push_unless_notify
...
Don't add notifications to the table unless there's actually a 'notify' action
2016-01-22 17:06:52 +00:00
David Baker
b4a41aa542
Don't add notifications to the table unless there's actually a 'notify' action
2016-01-22 16:56:48 +00:00
Erik Johnston
db6e26bb8c
Don't mutate cached values
2016-01-22 16:03:55 +00:00
David Baker
7065b75bfd
Don't crash if a user has no push rule enabled entries
2016-01-22 15:13:44 +00:00
David Baker
52bdd1b834
Overlay the push_rules_enabled map for users, otherwise they won't be able to disable server default rules.
2016-01-22 14:58:19 +00:00
Erik Johnston
0e07f2e15d
Only fetch events for rooms and receipts
2016-01-21 16:10:37 +00:00
Erik Johnston
3a00f13436
Only compute badge count when necessary.
...
This reverts commit d726597737
.
2016-01-21 14:56:11 +00:00
David Baker
930ba003f8
Remove member event rule as per SYN-607
2016-01-21 11:50:27 +00:00
David Baker
3fa344c037
Add storage function to get all receipts for a user. Also add some cache invalidation to the receipts storage because there wasn't any, and remove a method that was unused.
2016-01-20 15:30:31 +00:00
David Baker
7cc047455e
Inline membership specifier
2016-01-20 13:50:28 +00:00
David Baker
d726597737
Simplify badge updating code by just updating it every time we get woken up and it's not an event
2016-01-20 13:49:00 +00:00
David Baker
2309450a76
Merge branch 'develop' into push_badge_counts
2016-01-20 13:45:13 +00:00
David Baker
746f6e0eb3
'filtered' is a list of zero or 1
2016-01-20 13:44:04 +00:00
David Baker
7441d8cc0c
Merge remote-tracking branch 'origin/develop' into push_badge_counts
2016-01-20 13:40:22 +00:00
David Baker
259d1ecd1d
Don't generate push actions for our own events
2016-01-20 13:24:59 +00:00
David Baker
afb7b377f2
Merge branch 'develop' into push_badge_counts
2016-01-19 18:17:23 +00:00
Erik Johnston
fb5d8e58ff
Change regex cache size to 5000
2016-01-19 16:07:07 +00:00
Erik Johnston
5a7d1ecffc
Add regex cache. Only caculate push actions for users that have sent read receipts, and are on that server
2016-01-19 16:01:05 +00:00
Erik Johnston
d056a0a3d8
Handle glob -> regex errors
2016-01-19 14:43:24 +00:00
Erik Johnston
9654ee0848
Return don't break
2016-01-19 14:24:59 +00:00
Erik Johnston
7ecd211163
Except truthy values
2016-01-19 14:22:02 +00:00
Erik Johnston
9a8949f022
Merge branch 'develop' of github.com:matrix-org/synapse into default_notify
2016-01-19 11:37:05 +00:00
Erik Johnston
f750a442f7
Update _id
2016-01-19 10:14:53 +00:00
Erik Johnston
003853e702
Preserve truthiness
2016-01-18 17:34:02 +00:00
Erik Johnston
a284ad4092
You need to escape backslashes
2016-01-18 17:20:44 +00:00
Erik Johnston
47f82e4408
Fix branch didn't check word_boundary
2016-01-18 17:04:36 +00:00
Erik Johnston
29c353c553
Don't split at word boundaries, actually use regex
2016-01-18 16:48:17 +00:00
Erik Johnston
d16dcf642e
Drop log levels
2016-01-18 15:44:04 +00:00
Erik Johnston
7dd14e5d1c
Add comments and remove dead code
2016-01-18 15:42:23 +00:00
Erik Johnston
866fe27e78
Do for loop once at start
2016-01-18 15:29:41 +00:00
Erik Johnston
d1f56f732e
Use static for const dicts
2016-01-18 15:17:56 +00:00
Erik Johnston
345ff2196a
Don't edit ruleset
2016-01-18 14:50:17 +00:00
Erik Johnston
63485b3029
Re-enable urnead notifications
2016-01-18 14:48:30 +00:00
Erik Johnston
f59b564507
Make notifications go quicker
2016-01-18 14:48:29 +00:00
David Baker
12623c99b6
Use the unread notification count to send accurate badge counts in push notifications.
2016-01-13 18:55:57 +00:00
Erik Johnston
fcb05b4c82
Temporarily disable notification branch
2016-01-13 17:39:58 +00:00
Mark Haines
9c1f853d58
Rename 'user_name' to 'user_id' in push to make it consistent with the rest of the code
2016-01-13 13:32:59 +00:00
David Baker
d9db819e23
Change default pushrules back to notifying for all messages.
2016-01-13 13:15:53 +00:00
David Baker
c232780081
Merge pull request #456 from matrix-org/store_event_actions
...
Send unread notification counts
2016-01-08 14:47:15 +00:00
David Baker
823b679232
more commas
2016-01-07 10:02:47 +00:00
Matthew Hodgson
6c28ac260c
copyrights
2016-01-07 04:26:29 +00:00
David Baker
992928304f
Delete notifications for redacted events
2016-01-06 11:58:46 +00:00
David Baker
c79f221192
Add is_guest flag to users db to track whether a user is a guest user or not. Use this so we can run _filter_events_for_client when calculating event_push_actions.
2016-01-06 11:38:09 +00:00
David Baker
85ca8cb90c
comment typo
2016-01-05 13:32:39 +00:00
David Baker
c914d67cda
Rename event-actions to event_push_actions as per PR request
2016-01-04 14:05:37 +00:00
David Baker
3051c9d002
Address minor PR issues
2016-01-04 13:39:29 +00:00
David Baker
9b4cd0cd0f
pep8 & unused variable
2015-12-22 17:25:09 +00:00
David Baker
5645d9747b
Add some comments to areas that could be optimised.
2015-12-22 17:19:22 +00:00
David Baker
4c8f6a7e42
Insert push actions in a single db query rather than one per user/profile_tag
2015-12-22 17:04:31 +00:00
David Baker
65c451cb38
Add bulk push rule evaluator which actually still evaluates rules one by one, but does far fewer db queries to fetch the rules
2015-12-22 15:19:34 +00:00
David Baker
f73f154ec2
Only run pushers for users on this hs!
2015-12-21 15:28:54 +00:00
David Baker
42ad49f5b7
still very WIP, but now sends unread_notifications_count in the room object on sync (only actually corrrect in a full sync: hardcoded to 0 in incremental syncs).
2015-12-16 18:42:09 +00:00
David Baker
5e909c73d7
Store nothing instead of ['dont_notify'] for events with no notification required: much as it would be nice to be able to tell between the event not having been processed and there being no notification for it, this isn't worth filling up the table with ['dont_notify'] I think. Consequently treat the empty actions array as dont_notify and filter dont_notify out of the result.
2015-12-10 18:40:28 +00:00
David Baker
aa667ee396
Save event actions to the db
2015-12-10 17:51:15 +00:00
David Baker
21f135ba76
Very first cut of calculating actions for events as they come in. Doesn't store them yet. Not very efficient.
2015-12-10 16:26:08 +00:00
David Baker
a24eedada7
pep8
2015-12-09 15:57:42 +00:00
David Baker
4a728beba1
Split out the push rule evaluator into a separate file so it can be more readily reused. Should be functionally identical.
2015-12-09 15:51:34 +00:00
Mark Haines
5dc09e82c4
Merge pull request #413 from matrix-org/markjh/reuse_http_client
...
Reuse a single http client, rather than creating new ones
2015-12-02 12:56:23 +00:00
Mark Haines
37b2d69bbc
Reuse a single http client, rather than creating new ones
2015-12-02 11:36:02 +00:00
David Baker
4b1281f9b7
Change the m.room.message rule to be disabled by default so we only notify for 1:1 rooms / highlights out-of-the-box
2015-12-02 11:26:49 +00:00
David Baker
91482cd6a0
Use raw string for regex here, otherwise \b is the backspace character. Fixes displayname matching.
2015-10-08 11:22:15 +01:00
Erik Johnston
f8f3d72e2b
Don't make pushers handle presence/typing events
2015-08-24 16:19:43 +01:00
Erik Johnston
78fa346b07
Store the 'last_token' in the db, even if we processed no events
2015-08-19 10:08:31 +01:00
Erik Johnston
a45ec7c651
Block on storing the current last_tokens
2015-08-19 10:08:12 +01:00
Daniel Wagner-Hall
415c2f0549
Simplify LoginHander and AuthHandler
...
* Merge LoginHandler -> AuthHandler
* Add a bunch of documentation
* Improve some naming
* Remove unused branches
I will start merging the actual logic of the two handlers shortly
2015-08-12 15:49:37 +01:00
David Baker
6825eef955
Oops: underride rule had an identifier with override in it.
2015-06-23 14:26:14 +01:00
David Baker
b8690dd840
Catch any exceptions in the pusher loop. Use a lower timeout for pushers so we can see if they're actually still running.
2015-06-05 11:40:22 +01:00
Mark Haines
00dd207f60
Take a dict of the rule, not the rule list
2015-05-26 14:57:48 +01:00
Mark Haines
804b732aab
SYN-390: Don't modify the dictionary returned from the database here either
2015-05-26 10:35:08 +01:00
Mark Haines
2043527b9b
Don't try to use a txn when not in one, remove spurious debug logging
2015-05-21 16:53:03 +01:00
Mark Haines
53447e9cd3
Add caches for things requested by the pushers
2015-05-21 16:41:39 +01:00
Mark Haines
d61ce3f670
Add a cache for get_current_state with state_key
2015-05-21 16:41:39 +01:00
Erik Johnston
3e71d13acf
Also log when we've started pushers
2015-04-29 18:37:42 +01:00
Erik Johnston
c27d6ad6b5
Only start pushers when synapse has fully started
2015-04-29 18:25:24 +01:00
Erik Johnston
46daf2d200
Start pushers on reactor thread
2015-04-29 18:22:20 +01:00
David Baker
12d381bd5d
Decode the data json in the storage layer (was moved but this part was missed)
2015-04-29 17:13:51 +01:00
Erik Johnston
327ca883ec
Merge branch 'develop' of github.com:matrix-org/synapse into postgres
2015-04-28 13:39:42 +01:00
Mark Haines
9182f87664
Merge pull request #126 from matrix-org/csauth
...
Client / Server Auth Refactor
2015-04-28 11:00:27 +01:00
Erik Johnston
6f8e2d517e
Merge branch 'develop' of github.com:matrix-org/synapse into postgres
2015-04-27 14:41:40 +01:00
David Baker
ed83638668
Make one-to-one rule an underride otherwise bings don't work in one-to-one wrooms. Likewise a couple of other rules.
2015-04-24 14:27:17 +01:00
Mark Haines
4e2f8b8722
Copyright notices
2015-04-24 10:35:29 +01:00
Erik Johnston
bc9e69e160
Move encoding and decoding of JSON into storage layer
2015-04-16 11:01:09 +01:00
David Baker
6f4f7e4e22
pep8
2015-03-26 14:12:06 +00:00
David Baker
a32e876ef4
Delete pushers when changing password
2015-03-26 13:40:16 +00:00
David Baker
df4c12c762
pep8 blank lines
2015-03-25 19:08:17 +00:00
David Baker
c1a256cc4c
Allow multiple pushers for a single app ID & pushkey, honouring the 'append' flag in the API.
2015-03-25 19:06:22 +00:00
David Baker
c7023f2155
1) Pushers are now associated with an access token
...
2) Change places where we mean unauthenticated to 401, not 403, in C/S v2: hack so it stays as 403 in v1 because web client relies on it.
2015-03-24 17:24:15 +00:00
David Baker
bbb010a30f
More sacrifices to the pep8 gods.
2015-03-12 16:53:12 +00:00
David Baker
c92fdf88a3
Log the matching push rule.
2015-03-11 22:17:31 +00:00
David Baker
cdb2e045ee
Again, underscore, not hyphen
2015-03-11 14:22:35 +00:00
David Baker
465354ffde
'false' is not False
2015-03-11 11:24:50 +00:00
David Baker
83b1e7fb3c
PEP8 blank lines
2015-03-11 10:01:17 +00:00
David Baker
04f8478aaa
Add the master push rule for the break-my-push button. Allow server default rules to be disabled by default.
2015-03-10 17:26:25 +00:00
David Baker
1df3ccf7ee
D'oh: underscore, not hyphen
2015-03-09 12:39:56 +00:00
David Baker
118c883429
Call notifications should be override else they'll get clobbered by sender/room rules.
2015-03-06 19:41:36 +00:00
David Baker
be9dafcd37
Dial down logging for failed pushers
2015-03-06 15:32:38 +00:00
David Baker
96eda876a4
Specify when we don't want to highlight
2015-03-06 15:12:37 +00:00