summary refs log tree commit diff
path: root/synapse/push/emailpusher.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Write some tests for the email pusher (#4095)Amber Brown2018-10-301-1/+4
|
* sanity-check the is_processing flagRichard van der Hoff2018-10-241-4/+7
| | | | ... and rename it, for even more sanity
* Make on_started synchronous tooRichard van der Hoff2018-10-221-8/+7
| | | | | | This brings it into line with on_new_notifications and on_new_receipts. It requires a little bit of hoop-jumping in EmailPusher to load the throttle params before the first loop.
* Remove redundant run_as_background_process() from pusherpoolRichard van der Hoff2018-10-221-2/+1
| | | | | | | `on_new_notifications` and `on_new_receipts` in `HttpPusher` and `EmailPusher` now always return synchronously, so we can remove the `defer.gatherResults` on their results, and the `run_as_background_process` wrappers can be removed too because the PusherPool methods will now complete quickly enough.
* Give pushers their own background logcontextRichard van der Hoff2018-10-221-24/+24
| | | | | | | | Each pusher has its own loop which runs for as long as it has work to do. This should run in its own background thread with its own logcontext, as other similar loops elsewhere in the system do - which means that CPU usage is consistently attributed to that loop, rather than to whatever request happened to start the loop.
* run isortAmber Brown2018-07-091-4/+3
|
* Remove all global reactor imports & pass it around explicitly (#3424)Amber Brown2018-06-251-2/+2
|
* Improve exception handling for background processesRichard van der Hoff2018-04-271-4/+7
| | | | | | | | | | | | | | | | | | There were a bunch of places where we fire off a process to happen in the background, but don't have any exception handling on it - instead relying on the unhandled error being logged when the relevent deferred gets garbage-collected. This is unsatisfactory for a number of reasons: - logging on garbage collection is best-effort and may happen some time after the error, if at all - it can be hard to figure out where the error actually happened. - it is logged as a scary CRITICAL error which (a) I always forget to grep for and (b) it's not really CRITICAL if a background process we don't care about fails. So this is an attempt to add exception handling to everything we fire off into the background.
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-1/+1
| | | | what could possibly go wrong
* Only load jinja2 templates onceErik Johnston2017-05-221-12/+3
| | | | | Instead of every time a new email pusher is created, as loading jinja2 templates is slow.
* Ensure we pass positive ints to delay functionErik Johnston2017-02-221-1/+2
|
* Reduce redundant database work in email pusherErik Johnston2016-10-181-0/+4
| | | | | | | Update the last stream ordering if the `get_unread_push_actions_for_user_in_range_for_email` returns no new push actions. This reduces the range that it needs to check next iteration.
* Ignore AlreadyCalled errors on timer cancelErik Johnston2016-07-311-2/+10
|
* Create separate methods for getting messages to pushMark Haines2016-07-281-3/+2
| | | | | | | | | | | for the email and http pushers rather than trying to make a single method that will work with their conflicting requirements. The http pusher needs to get the messages in ascending stream order, and doesn't want to miss a message. The email pusher needs to get the messages in descending timestamp order, and doesn't mind if it misses messages.
* Merge remote-tracking branch 'origin/develop' into dbkr/email_unsubscribeDavid Baker2016-06-021-2/+8
|\
| * Disable INCLUDE_ALL_UNREAD_NOTIFSErik Johnston2016-06-021-1/+2
| |
| * if an email pusher specifies a brand param, use itMatthew Hodgson2016-06-021-1/+6
| |
* | Email unsubscribing that may in theory, workDavid Baker2016-06-021-1/+1
|/ | | | Were it not for that fact that you can't use the base handler in the pusher because it pulls in the world. Comitting while I fix that on a different branch.
* Tune email notifs to make them quieter:Matthew Hodgson2016-05-231-8/+18
| | | | | | | | * After initial 10 minute window, only alert every 24h for room notifs * Reset room state after 6h of idleness * Synchronise throttles for messages sent in the same notif, so the 24 hourly notifs 'line up' * Fix the email subjects to say what triggered the notification * Order the rooms in reverse activity order in the email, so the 'reason' room should always come first
* tune email notifs, fix CSS a bit, and add debugging detailsMatthew Hodgson2016-05-161-8/+24
|
* Add constant for throttle multiplierDavid Baker2016-04-291-1/+2
|
* Remove unused functionDavid Baker2016-04-291-4/+0
|
* Remove unused argDavid Baker2016-04-291-2/+2
|
* Remove rather pointless get functionDavid Baker2016-04-291-9/+1
|
* Stop processing notifs once we've sent a mailDavid Baker2016-04-291-0/+1
|
* Put back real delay before mailingDavid Baker2016-04-281-1/+1
|
* Better grammar for multiple messages in a roomDavid Baker2016-04-271-1/+1
| | | | Say who the messages are from if there's no room name, otherwise it's a bit nonsensical
* No inlineCallbacks necessary on thisDavid Baker2016-04-221-1/+0
|
* Flesh out email templatingDavid Baker2016-04-211-0/+7
| | | | Mostly WIP porting the room name calculation logic from the web client so our room names in the email mirror the clients.
* Generate mails from a templateDavid Baker2016-04-201-8/+4
|
* Send a rather basic email notifDavid Baker2016-04-201-9/+23
| | | | Also pep8 fixes
* Add single instance & logging stuffDavid Baker2016-04-191-8/+39
| | | | Copy the stuff over from http pusher that prevents multiple instances of process running at once and sets up logging and measure blocks.
* First bits of emailpusherDavid Baker2016-04-191-0/+214
Mostly logic of when to send an email