Performance improvements and refactor of Ratelimiter (#7595)
While working on https://github.com/matrix-org/synapse/issues/5665 I found myself digging into the `Ratelimiter` class and seeing that it was both: * Rather undocumented, and * causing a *lot* of config checks This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. Best to be reviewed commit-by-commit.
Showing
- changelog.d/7595.misc 1 addition, 0 deletionschangelog.d/7595.misc
- synapse/api/ratelimiting.py 118 additions, 35 deletionssynapse/api/ratelimiting.py
- synapse/config/ratelimiting.py 7 additions, 1 deletionsynapse/config/ratelimiting.py
- synapse/handlers/_base.py 29 additions, 31 deletionssynapse/handlers/_base.py
- synapse/handlers/auth.py 8 additions, 16 deletionssynapse/handlers/auth.py
- synapse/handlers/message.py 0 additions, 1 deletionsynapse/handlers/message.py
- synapse/handlers/register.py 1 addition, 8 deletionssynapse/handlers/register.py
- synapse/rest/client/v1/login.py 21 additions, 44 deletionssynapse/rest/client/v1/login.py
- synapse/rest/client/v2_alpha/register.py 1 addition, 15 deletionssynapse/rest/client/v2_alpha/register.py
- synapse/server.py 7 additions, 10 deletionssynapse/server.py
- synapse/util/ratelimitutils.py 1 addition, 1 deletionsynapse/util/ratelimitutils.py
- tests/api/test_ratelimiting.py 77 additions, 19 deletionstests/api/test_ratelimiting.py
- tests/handlers/test_profile.py 1 addition, 5 deletionstests/handlers/test_profile.py
- tests/replication/slave/storage/_base.py 2 additions, 7 deletionstests/replication/slave/storage/_base.py
- tests/rest/client/v1/test_events.py 2 additions, 6 deletionstests/rest/client/v1/test_events.py
- tests/rest/client/v1/test_login.py 39 additions, 10 deletionstests/rest/client/v1/test_login.py
- tests/rest/client/v1/test_rooms.py 2 additions, 7 deletionstests/rest/client/v1/test_rooms.py
- tests/rest/client/v1/test_typing.py 2 additions, 8 deletionstests/rest/client/v1/test_typing.py
- tests/rest/client/v2_alpha/test_register.py 3 additions, 6 deletionstests/rest/client/v2_alpha/test_register.py
Loading
Please register or sign in to comment