File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
tests/test_asyncio/test_multidb Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ async def mock_check_health(database):
201201 assert await db1_became_unhealthy .wait (), (
202202 "Timeout waiting for mock_db1 to become unhealthy"
203203 )
204+
204205 await asyncio .sleep (0.01 )
205206
206207 assert await client .set ("key" , "value" ) == "OK2"
@@ -209,7 +210,14 @@ async def mock_check_health(database):
209210 assert await db2_became_unhealthy .wait (), (
210211 "Timeout waiting for mock_db2 to become unhealthy"
211212 )
212- await asyncio .sleep (0.01 )
213+
214+ # Wait for circuit breaker state to actually reflect the unhealthy status
215+ # (instead of just sleeping)
216+ max_retries = 10
217+ for _ in range (max_retries ):
218+ if cb2 .state == CBState .OPEN : # Circuit is open (unhealthy)
219+ break
220+ await asyncio .sleep (0.01 )
213221
214222 assert await client .set ("key" , "value" ) == "OK"
215223
You can’t perform that action at this time.
0 commit comments