mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 17:55:23 -04:00
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.
This commit is contained in:
parent
c389bfb6ea
commit
f4e6495b5d
19 changed files with 325 additions and 233 deletions
|
@ -13,7 +13,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from mock import Mock, NonCallableMock
|
||||
from mock import Mock
|
||||
|
||||
from tests.replication._base import BaseStreamTestCase
|
||||
|
||||
|
@ -21,12 +21,7 @@ from tests.replication._base import BaseStreamTestCase
|
|||
class BaseSlavedStoreTestCase(BaseStreamTestCase):
|
||||
def make_homeserver(self, reactor, clock):
|
||||
|
||||
hs = self.setup_test_homeserver(
|
||||
federation_client=Mock(),
|
||||
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
|
||||
)
|
||||
|
||||
hs.get_ratelimiter().can_do_action.return_value = (True, 0)
|
||||
hs = self.setup_test_homeserver(federation_client=Mock())
|
||||
|
||||
return hs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue