summary refs log tree commit diff
path: root/synapse/push/pusherpool.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix concurrent modification errors in pusher metrics (#7106)Richard van der Hoff2020-03-191-9/+18
| | | add a lock to try to make this metric actually work
* Add prometheus metrics for the number of active pushers (#7103)Richard van der Hoff2020-03-191-1/+23
|
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-1/+1
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Clean up startup for the pusher (#6558)Richard van der Hoff2019-12-181-4/+6
| | | | | | | | | | | | | | | | | | | | | | | * Remove redundant python2 support code `str.decode()` doesn't exist on python3, so presumably this code was doing nothing * Filter out pushers with corrupt data When we get a row with unparsable json, drop the row, rather than returning a row with null `data`, which will then cause an explosion later on. * Improve logging when we can't start a pusher Log the ID to help us understand the problem * Make email pusher setup more robust We know we'll have a `data` member, since that comes from the database. What we *don't* know is if that is a dict, and if that has a `brand` member, and if that member is a string.
* Update black to 19.10b0 (#6304)Amber Brown2019-11-011-3/+1
| | | * update version of black and also fix the mypy config being overridden
* Replace returnValue with return (#5736)Amber Brown2019-07-231-3/+3
|
* Run Black. (#5482)Amber Brown2019-06-201-44/+53
|
* Add testErik Johnston2019-06-071-7/+23
|
* Make starting pushers faster during start upErik Johnston2019-04-021-4/+24
| | | | | | | | | | | We start all pushers on start up and immediately start a background process to fetch push to send. This makes start up incredibly painful when dealing with many pushers. Instead, let's do a quick fast DB check to see if there *may* be push to send and only start the background processes for those pushers. We also stagger starting up and doing those checks so that we don't try and handle all pushers at once.
* Add missing returnErik Johnston2019-02-221-0/+1
|
* Correctly handle PusherConfigExceptionErik Johnston2019-02-221-0/+9
|
* bail out early in on_new_receipts if no pushers (#4706)Richard van der Hoff2019-02-211-0/+8
|
* Fix start_pushers vs _start_pushers confusionRichard van der Hoff2018-10-241-3/+3
|
* Run PusherPool.start as a background processRichard van der Hoff2018-10-221-5/+7
| | | | | We don't do anything with the result, so this is needed to give this code a logcontext.
* Make on_started synchronous tooRichard van der Hoff2018-10-221-2/+14
| | | | | | 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-40/+7
| | | | | | | `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.
* move get_all_pushers call downRichard van der Hoff2018-10-221-3/+9
| | | | simplifies the interface to _start_pushers
* Factor PusherPool._start_pusher out of _start_pushersRichard van der Hoff2018-10-221-18/+33
| | | | | ... and use it from start_pusher_by_id. This mostly simplifies start_pusher_by_id.
* Rename _refresh_pusherRichard van der Hoff2018-10-221-2/+3
| | | | | This is public (or at least, called from outside the class), so ought to have a better name.
* Fix logcontexts for running pushersRichard van der Hoff2018-08-171-2/+15
| | | | | | | First of all, avoid resetting the logcontext before running the pushers, to fix the "Starting db txn 'get_all_updated_receipts' from sentinel context" warning. Instead, give them their own "background process" logcontexts.
* Remove run_on_reactor (#3395)Amber Brown2018-06-141-3/+0
|
* Merge remote-tracking branch 'origin/develop' into rav/use_run_in_backgroundRichard van der Hoff2018-04-271-2/+6
|\
| * Add missing consumeErrorsRichard van der Hoff2018-04-271-2/+6
| | | | | | | | | | In general we want defer.gatherResults to consumeErrors, rather than having exceptions hanging around and getting logged as CRITICAL unhandled errors.
* | Use run_in_background in preference to preserve_fnRichard van der Hoff2018-04-271-8/+12
|/ | | | | | While I was going through uses of preserve_fn for other PRs, I converted places which only use the wrapped function once to use run_in_background, to avoid creating the function object.
* Remove pushers when deleting access tokensRichard van der Hoff2017-11-291-9/+15
| | | | | Whenever an access token is invalidated, we should remove the associated pushers.
* Remove preserve_context_over_{fn, deferred}Richard van der Hoff2017-11-141-3/+3
| | | | | Both of these functions ae known to leak logcontexts. Replace the remaining calls to them and kill them off.
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-3/+3
| | | | what could possibly go wrong
* Only load jinja2 templates onceErik Johnston2017-05-221-3/+4
| | | | | Instead of every time a new email pusher is created, as loading jinja2 templates is slow.
* Preserve some logcontextsErik Johnston2016-08-241-5/+7
|
* Refactor user_delete_access_tokens. Invalidate get_user_by_access_token to ↵Erik Johnston2016-08-151-4/+4
| | | | slaves.
* Unused importDavid Baker2016-05-041-1/+0
|
* Catch all exceptions when creating a pusherDavid Baker2016-05-041-2/+2
|
* Add an email pusher for new usersDavid Baker2016-04-291-0/+1
| | | | If they registered with an email address and email notifs are enabled on the HS
* Optionally split out the pushers into a separate processMark Haines2016-04-211-0/+4
|
* Unused member variableDavid Baker2016-04-121-1/+0
|
* indentingDavid Baker2016-04-071-1/+1
|
* defer.gatherResults rather than doing all the pokes in seriesDavid Baker2016-04-071-2/+16
|
* Send badge count pushes.David Baker2016-04-071-1/+19
| | | | Also fix bugs with retrying.
* Make pushers use the event_push_actions table instead of listening on an ↵David Baker2016-04-061-34/+41
| | | | | | | event stream & running the rules again. Sytest passes, but remaining to do: * Make badges work again * Remove old, unused code
* Make select more sensible when dseleting access tokens, rename pusher ↵David Baker2016-03-111-1/+1
| | | | deletion to match access token deletion and make exception arg optional.
* Fix cache invalidation so deleting access tokens (which we did when changing ↵David Baker2016-03-111-4/+4
| | | | password) actually takes effect without HS restart. Reinstate the code to avoid logging out the session that changed the password, removed in 415c2f05491ce65a4fc34326519754cd1edd9c54
* Fix relative imports so they work in both py3 and py27Mark Haines2016-03-081-1/+1
|
* Remove dead code for setting device specific rules.Mark Haines2016-02-181-28/+20
| | | | | | 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.
* Fix up logcontextsErik Johnston2016-02-081-4/+5
|
* Merge branch 'develop' into push_badge_countsDavid Baker2016-01-191-13/+13
|\
| * Rename 'user_name' to 'user_id' in push to make it consistent with the rest ↵Mark Haines2016-01-131-15/+15
| | | | | | | | of the code
* | Use the unread notification count to send accurate badge counts in push ↵David Baker2016-01-131-15/+0
|/ | | | notifications.
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Simplify LoginHander and AuthHandlerDaniel Wagner-Hall2015-08-121-7/+4
| | | | | | | | | * 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
* Also log when we've started pushersErik Johnston2015-04-291-0/+2
|
* Only start pushers when synapse has fully startedErik Johnston2015-04-291-3/+0
|
* Start pushers on reactor threadErik Johnston2015-04-291-0/+3
|
* Decode the data json in the storage layer (was moved but this part was missed)David Baker2015-04-291-1/+5
|
* Merge branch 'develop' of github.com:matrix-org/synapse into postgresErik Johnston2015-04-281-15/+61
|\
| * pep8David Baker2015-03-261-2/+4
| |
| * Delete pushers when changing passwordDavid Baker2015-03-261-2/+18
| |
| * pep8 blank linesDavid Baker2015-03-251-1/+0
| |
| * Allow multiple pushers for a single app ID & pushkey, honouring the 'append' ↵David Baker2015-03-251-10/+37
| | | | | | | | flag in the API.
| * 1) Pushers are now associated with an access tokenDavid Baker2015-03-241-4/+5
| | | | | | | | 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.
* | Move encoding and decoding of JSON into storage layerErik Johnston2015-04-161-7/+1
|/
* Use encode_canonical_json for pushesErik Johnston2015-02-111-1/+3
|
* Blunty replace json with simplejsonErik Johnston2015-02-111-1/+1
|
* s/instance_handle/profile_tag/David Baker2015-02-031-6/+6
|
* Code style fixes.Mark Haines2015-01-291-1/+1
|
* Easy on the newlinesDavid Baker2015-01-281-1/+0
|
* 2015David Baker2015-01-281-1/+1
|
* Unused importDavid Baker2015-01-281-1/+0
|
* Reset badge count to zero when last active time is bumpedDavid Baker2015-01-281-0/+17
|
* add instance_handles to pushers so we have a way to refer to them even if ↵David Baker2015-01-201-3/+6
| | | | the push token changes.
* Require device language when adding a pusher.David Baker2015-01-161-3/+5
| | | | | Because this seems like it might be useful to do sooner rather than later.
* Honour the 'rejected' return from push gatewaysDavid Baker2015-01-131-0/+12
| | | | | | | Add a timestamp to push tokens so we know the last time they we got them from the device. Send it to the push gateways so it can determine whether its failure is more recent than the token. Stop and remove pushers that have been rejected.
* after a few rethinks, a working implementation of pushers.David Baker2014-12-181-21/+26
|
* Update to app_id / app_instance_id (partially) and mangle to be PEP8 compliant.David Baker2014-12-031-29/+46
|
* More work on pushers. Attempt to do HTTP pokes. Not sure if the actual HTTP ↵David Baker2014-11-211-2/+6
| | | | pokes work or not yet but the retry semantics are pretty good.
* Start creating a module to do generic notifications (just prints them to ↵David Baker2014-11-191-0/+94
stdout currently!)