rate_limit: Adjust keys() of some RateLimitedObjects.

type().__name__ is sufficient, and much readable than type(), so it's
better to use the former for keys.
We also make the classes consistent in forming the keys in the format
type(self).__name__:identifier and adjust logger.warning and statsd to
take advantage of that and simply log the key().
This commit is contained in:
Mateusz Mandera
2020-03-06 10:56:36 +01:00
committed by Tim Abbott
parent 2c6b1fd575
commit 4e9f77a6c4
6 changed files with 9 additions and 9 deletions

View File

@@ -411,7 +411,8 @@ class WorkerTest(ZulipTestCase):
fake_client.queue.append(('email_mirror', data[0]))
worker.start()
self.assertEqual(mock_mirror_email.call_count, 4)
expected_warn = "Deadlock trying to incr_ratelimit for RateLimitedRealmMirror:zulip"
expected_warn = "Deadlock trying to incr_ratelimit for RateLimitedRealmMirror:%s" % (
realm.string_id,)
mock_warn.assert_called_with(expected_warn)
def test_email_sending_worker_retries(self) -> None: