Export RatelimitOverride from ModuleApi (#18513)

This commit is contained in:
Hugh Nimmo-Smith
2025-06-06 11:48:49 +01:00
committed by GitHub
parent e80bc4b062
commit 82189cbde4
7 changed files with 28 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ The available ratelimit callbacks are:
_First introduced in Synapse v1.132.0_
```python
async def get_ratelimit_override_for_user(user: str, limiter_name: str) -> Optional[RatelimitOverride]
async def get_ratelimit_override_for_user(user: str, limiter_name: str) -> Optional[synapse.module_api.RatelimitOverride]
```
Called when constructing a ratelimiter of a particular type for a user. The module can
@@ -26,6 +26,11 @@ The limiters that are currently supported are:
- `rc_invites.per_user`
- `rc_invites.per_issuer`
The `RatelimitOverride` return type has the following fields:
- `per_second: float`. The number of actions that can be performed in a second. `0.0` means that ratelimiting is disabled.
- `burst_count: int`. The number of actions that can be performed before being limited.
If multiple modules implement this callback, they will be considered in order. If a
callback returns `None`, Synapse falls through to the next one. The value of the first
callback that does not return `None` will be used. If this happens, Synapse will not call