diff options
author | Luke Barnard <lukeb@openmarket.com> | 2016-10-18 17:04:09 +0100 |
---|---|---|
committer | Luke Barnard <lukeb@openmarket.com> | 2016-10-18 17:04:09 +0100 |
commit | 5b54d51d1e98450451b8ffe3a57ad98373e8f5e6 (patch) | |
tree | 0d5a94da69eafae973f8c616668f99c4a3c845cd /synapse/config/appservice.py | |
parent | Merge branch 'release-v0.18.2' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-5b54d51d1e98450451b8ffe3a57ad98373e8f5e6.tar.xz |
Allow Configurable Rate Limiting Per AS
This adds a flag loaded from the registration file of an AS that will determine whether or not its users are rate limited (by ratelimit in _base.py). Needed for IRC bridge reasons - see https://github.com/matrix-org/matrix-appservice-irc/issues/240.
Diffstat (limited to 'synapse/config/appservice.py')
-rw-r--r-- | synapse/config/appservice.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py index d7537e8d44..82c50b8240 100644 --- a/synapse/config/appservice.py +++ b/synapse/config/appservice.py @@ -110,6 +110,11 @@ def _load_appservice(hostname, as_info, config_filename): user = UserID(localpart, hostname) user_id = user.to_string() + # Rate limiting for users of this AS is on by default (excludes sender) + rate_limited = True + if isinstance(as_info.get("rate_limited"), bool): + rate_limited = as_info.get("rate_limited") + # namespace checks if not isinstance(as_info.get("namespaces"), dict): raise KeyError("Requires 'namespaces' object.") @@ -155,4 +160,5 @@ def _load_appservice(hostname, as_info, config_filename): sender=user_id, id=as_info["id"], protocols=protocols, + rate_limited=rate_limited ) |