Skip to content

Add ratelimit callbacks to module API to allow dynamic ratelimiting #18458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025

Conversation

hughns
Copy link
Member

@hughns hughns commented May 19, 2025

Adds new callback get_ratelimit_override_for_user which is invoked for a small subset of limiter types.

More details are in the documentation: https://github.com/element-hq/synapse/blob/hughns/ratelimit-callbacks/docs/modules/ratelimit_callbacks.md

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Sorry, something went wrong.

@github-actions github-actions bot deployed to PR Documentation Preview May 19, 2025 16:09 Active
@github-actions github-actions bot deployed to PR Documentation Preview May 27, 2025 12:41 Active
@hughns hughns marked this pull request as ready for review May 27, 2025 12:46
@hughns hughns requested a review from a team as a code owner May 27, 2025 12:46
@github-actions github-actions bot deployed to PR Documentation Preview May 27, 2025 12:46 Active
Adds new callback `get_ratelimit_override_for_user` which is invoked for a small subset of limiter types.
@hughns hughns force-pushed the hughns/ratelimit-callbacks branch from f2bf4a1 to 2799fcd Compare May 29, 2025 08:18
@github-actions github-actions bot deployed to PR Documentation Preview May 29, 2025 08:19 Active

### `get_ratelimit_override_for_user`

_First introduced in Synapse v1.X.X_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs tweak before merge

hughns added 2 commits June 4, 2025 12:21
@github-actions github-actions bot deployed to PR Documentation Preview June 4, 2025 11:27 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 4, 2025 11:42 Active
@hughns hughns enabled auto-merge (squash) June 4, 2025 11:43
@hughns hughns merged commit 9b2bc75 into develop Jun 4, 2025
45 checks passed
@hughns hughns deleted the hughns/ratelimit-callbacks branch June 4, 2025 12:09
Michael-Ixo pushed a commit to ixoworld/synapse that referenced this pull request Jun 25, 2025
- Improvements to generate config documentation from JSON Schema file. ([\element-hq#18522](element-hq#18522))

- Add support for [MSC4155](matrix-org/matrix-spec-proposals#4155) Invite Filtering. ([\element-hq#18288](element-hq#18288))
- Add experimental `user_may_send_state_event` module API callback. ([\element-hq#18455](element-hq#18455))
- Add experimental `get_media_config_for_user` and `is_user_allowed_to_upload_media_of_size` module API callbacks that allow overriding of media repository maximum upload size. ([\element-hq#18457](element-hq#18457))
- Add experimental `get_ratelimit_override_for_user` module API callback that allows overriding of per-user ratelimits. ([\element-hq#18458](element-hq#18458))
- Pass `room_config` argument to `user_may_create_room` spam checker module callback. ([\element-hq#18486](element-hq#18486))
- Support configuration of default and extra user types. ([\element-hq#18456](element-hq#18456))
- Successful requests to `/_matrix/app/v1/ping` will now force Synapse to reattempt delivering transactions to appservices. ([\element-hq#18521](element-hq#18521))
- Support the import of the `RatelimitOverride` type from `synapse.module_api` in modules and rename `messages_per_second` to `per_second`. ([\element-hq#18513](element-hq#18513))

- Remove destinations from sending if not whitelisted. ([\element-hq#18484](element-hq#18484))
- Fixed room summary API incorrectly returning that a room is private in the room summary response when the join rule is omitted by the remote server. Contributed by @nexy7574. ([\element-hq#18493](element-hq#18493))
- Prevent users from adding themselves to their own user ignore list. ([\element-hq#18508](element-hq#18508))

- Generate config documentation from JSON Schema file. ([\element-hq#17892](element-hq#17892))
- Mention `CAP_NET_BIND_SERVICE` as an alternative to running Synapse as root in order to bind to a privileged port. ([\element-hq#18408](element-hq#18408))
- Surface hidden Admin API documentation regarding fetching of scheduled tasks. ([\element-hq#18516](element-hq#18516))
- Mark the new module APIs in this release as experimental. ([\element-hq#18536](element-hq#18536))

- Mark dehydrated devices in the [List All User Devices Admin API](https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#list-all-devices). ([\element-hq#18252](element-hq#18252))
- Reduce disk wastage by cleaning up `received_transactions` older than 1 day, rather than 30 days. ([\element-hq#18310](element-hq#18310))
- Distinguish all vs local events being persisted in the "Event Send Time Quantiles" graph (Grafana). ([\element-hq#18510](element-hq#18510))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants