mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
zilencer: Log warning when a remote server hits rate limits.
We don't want this rate limit to affect legitimate users so it being hit should be abnormal - thus worth logging so that we can spot if we're rate limiting legitimate users and can know to increase the limit.
This commit is contained in:
committed by
Tim Abbott
parent
85cbdc8904
commit
093ca7a574
@@ -192,7 +192,14 @@ class RateLimitTests(ZulipTestCase):
|
||||
self.DEFAULT_SUBDOMAIN = ""
|
||||
|
||||
RateLimitedRemoteZulipServer(server).clear_history()
|
||||
self.do_test_hit_ratelimits(lambda: self.uuid_post(server_uuid, endpoint, payload))
|
||||
with self.assertLogs("zerver.lib.rate_limiter", level="WARNING") as m:
|
||||
self.do_test_hit_ratelimits(lambda: self.uuid_post(server_uuid, endpoint, payload))
|
||||
self.assertEqual(
|
||||
m.output,
|
||||
[
|
||||
"WARNING:zerver.lib.rate_limiter:Remote server <RemoteZulipServer demo.example.com 1234-abcd> exceeded rate limits on domain api_by_remote_server"
|
||||
],
|
||||
)
|
||||
finally:
|
||||
self.DEFAULT_SUBDOMAIN = original_default_subdomain
|
||||
remove_ratelimit_rule(1, 5, domain="api_by_remote_server")
|
||||
|
||||
Reference in New Issue
Block a user