@@ -31,7 +31,14 @@ class RetryLimiterTestCase(HomeserverTestCase):
3131 def test_new_destination (self ) -> None :
3232 """A happy-path case with a new destination and a successful operation"""
3333 store = self .hs .get_datastores ().main
34- limiter = self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
34+ limiter = self .get_success (
35+ get_retry_limiter (
36+ destination = "test_dest" ,
37+ our_server_name = self .hs .hostname ,
38+ clock = self .clock ,
39+ store = store ,
40+ )
41+ )
3542
3643 # advance the clock a bit before making the request
3744 self .pump (1 )
@@ -46,7 +53,14 @@ def test_limiter(self) -> None:
4653 """General test case which walks through the process of a failing request"""
4754 store = self .hs .get_datastores ().main
4855
49- limiter = self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
56+ limiter = self .get_success (
57+ get_retry_limiter (
58+ destination = "test_dest" ,
59+ our_server_name = self .hs .hostname ,
60+ clock = self .clock ,
61+ store = store ,
62+ )
63+ )
5064
5165 min_retry_interval_ms = (
5266 self .hs .config .federation .destination_min_retry_interval_ms
@@ -72,15 +86,28 @@ def test_limiter(self) -> None:
7286
7387 # now if we try again we should get a failure
7488 self .get_failure (
75- get_retry_limiter ("test_dest" , self .clock , store ), NotRetryingDestination
89+ get_retry_limiter (
90+ destination = "test_dest" ,
91+ our_server_name = self .hs .hostname ,
92+ clock = self .clock ,
93+ store = store ,
94+ ),
95+ NotRetryingDestination ,
7696 )
7797
7898 #
7999 # advance the clock and try again
80100 #
81101
82102 self .pump (min_retry_interval_ms )
83- limiter = self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
103+ limiter = self .get_success (
104+ get_retry_limiter (
105+ destination = "test_dest" ,
106+ our_server_name = self .hs .hostname ,
107+ clock = self .clock ,
108+ store = store ,
109+ )
110+ )
84111
85112 self .pump (1 )
86113 try :
@@ -108,7 +135,14 @@ def test_limiter(self) -> None:
108135 # one more go, with success
109136 #
110137 self .reactor .advance (min_retry_interval_ms * retry_multiplier * 2.0 )
111- limiter = self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
138+ limiter = self .get_success (
139+ get_retry_limiter (
140+ destination = "test_dest" ,
141+ our_server_name = self .hs .hostname ,
142+ clock = self .clock ,
143+ store = store ,
144+ )
145+ )
112146
113147 self .pump (1 )
114148 with limiter :
@@ -129,9 +163,10 @@ def test_notifier_replication(self) -> None:
129163
130164 limiter = self .get_success (
131165 get_retry_limiter (
132- "test_dest" ,
133- self .clock ,
134- store ,
166+ destination = "test_dest" ,
167+ our_server_name = self .hs .hostname ,
168+ clock = self .clock ,
169+ store = store ,
135170 notifier = notifier ,
136171 replication_client = replication_client ,
137172 )
@@ -199,7 +234,14 @@ def test_max_retry_interval(self) -> None:
199234 self .hs .config .federation .destination_max_retry_interval_ms
200235 )
201236
202- self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
237+ self .get_success (
238+ get_retry_limiter (
239+ destination = "test_dest" ,
240+ our_server_name = self .hs .hostname ,
241+ clock = self .clock ,
242+ store = store ,
243+ )
244+ )
203245 self .pump (1 )
204246
205247 failure_ts = self .clock .time_msec ()
@@ -216,12 +258,25 @@ def test_max_retry_interval(self) -> None:
216258
217259 # Check it fails
218260 self .get_failure (
219- get_retry_limiter ("test_dest" , self .clock , store ), NotRetryingDestination
261+ get_retry_limiter (
262+ destination = "test_dest" ,
263+ our_server_name = self .hs .hostname ,
264+ clock = self .clock ,
265+ store = store ,
266+ ),
267+ NotRetryingDestination ,
220268 )
221269
222270 # Get past retry_interval and we can try again, and still throw an error to continue the backoff
223271 self .reactor .advance (destination_max_retry_interval_ms / 1000 + 1 )
224- limiter = self .get_success (get_retry_limiter ("test_dest" , self .clock , store ))
272+ limiter = self .get_success (
273+ get_retry_limiter (
274+ destination = "test_dest" ,
275+ our_server_name = self .hs .hostname ,
276+ clock = self .clock ,
277+ store = store ,
278+ )
279+ )
225280 self .pump (1 )
226281 try :
227282 with limiter :
@@ -239,5 +294,11 @@ def test_max_retry_interval(self) -> None:
239294
240295 # Check it fails
241296 self .get_failure (
242- get_retry_limiter ("test_dest" , self .clock , store ), NotRetryingDestination
297+ get_retry_limiter (
298+ destination = "test_dest" ,
299+ our_server_name = self .hs .hostname ,
300+ clock = self .clock ,
301+ store = store ,
302+ ),
303+ NotRetryingDestination ,
243304 )
0 commit comments