synapse/synapse
Erik Johnston 0779587f9f
Lift pausing on ratelimited requests to http layer (#18595)
When a request gets ratelimited we (optionally) wait ~500ms before
returning to mitigate clients that like to tightloop on request
failures. However, this is currently implemented by pausing request
processing when we check for ratelimits, which might be deep within
request processing, and e.g. while locks are held. Instead, let's hoist
the pause to the very top of the HTTP handler.

Hopefully, this mitigates the issue where a user sending lots of events
to a single room can see their requests time out due to the combination
of the linearizer and the pausing of the request. Instead, they should
see the requests 429 after ~500ms.

The first commit is a refactor to pass the `Clock` to `AsyncResource`,
the second commit is the behavioural change.
2025-06-25 14:32:55 +00:00
..
_scripts Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
api Lift pausing on ratelimited requests to http layer (#18595) 2025-06-25 14:32:55 +00:00
app Fix typo of Math.pow, ^ -> ** (#18543) 2025-06-13 11:36:21 +00:00
appservice Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
config Add report user API from MSC4260 (#18120) 2025-06-20 13:02:14 +01:00
crypto Fix fetching signing keys when old_verify_keys is omitted (#17568) 2024-08-14 14:13:56 +01:00
events Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
federation Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
handlers Add report user API from MSC4260 (#18120) 2025-06-20 13:02:14 +01:00
http Lift pausing on ratelimited requests to http layer (#18595) 2025-06-25 14:32:55 +00:00
logging Speed up MAS token introspection (#18357) 2025-06-16 16:41:35 +01:00
media Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
metrics Enable flake8-logging and flake8-logging-format rules in Ruff and fix related issues throughout the codebase (#18542) 2025-06-13 09:44:18 +02:00
module_api Export RatelimitOverride from ModuleApi (#18513) 2025-06-06 10:48:49 +00:00
push bugfix: assert we always pass the create event to get_user_power_level (#18545) 2025-06-13 16:32:24 +00:00
replication Bump ruff from 0.7.3 to 0.11.10 (#18451) 2025-05-20 15:23:30 +01:00
res Send an email if the address is already bound to an user account (#16819) 2024-04-23 16:45:24 +01:00
rest Lift pausing on ratelimited requests to http layer (#18595) 2025-06-25 14:32:55 +00:00
server_notices Format files with Ruff (#17643) 2024-09-02 12:39:04 +01:00
spam_checker_api Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
state bugfix: assert we always pass the create event to get_user_power_level (#18545) 2025-06-13 16:32:24 +00:00
static Update link to the clients webpage, fix #15825 (#15874) 2023-07-06 17:28:09 +02:00
storage Fix registering of background updates for split main/state db (#18509) 2025-06-25 13:59:18 +01:00
streams Fix regression when bounding future tokens (#17391) 2024-07-02 14:06:36 +01:00
synapse_rust Speed up MAS token introspection (#18357) 2025-06-16 16:41:35 +01:00
types Fix registering of background updates for split main/state db (#18509) 2025-06-25 13:59:18 +01:00
util Clean up old device_federation_inbox rows (#18546) 2025-06-18 11:58:31 +00:00
__init__.py Remove support for python 3.8 (#17908) 2024-11-06 19:36:01 +00:00
_pydantic_compat.py import pydantic objects from the _pydantic_compat module (#17667) 2024-09-11 21:01:43 +00:00
event_auth.py bugfix: assert we always pass the create event to get_user_power_level (#18545) 2025-06-13 16:32:24 +00:00
notifier.py remove room without listeners from Notifier.room_to_user_streams (#18380) 2025-05-15 18:18:17 +01:00
py.typed
server.py Add report user API from MSC4260 (#18120) 2025-06-20 13:02:14 +01:00
visibility.py Move server event filtering logic to rust (#17928) 2024-11-14 16:18:24 +00:00