MCPcopy
hub / github.com/redis/redis-py / call_with_retry

Method call_with_retry

tests/test_asyncio/test_connection.py:275–288  ·  view source on GitHub ↗
(self, _, __, with_failure_count=False)

Source from the content-addressed store, hash-verified

273
274 class Retry_:
275 async def call_with_retry(self, _, __, with_failure_count=False):
276 # If we remove the single-client lock, this error gets raised as two
277 # coroutines will be vying for the `in_use` flag due to the two
278 # asymmetric sleep calls
279 nonlocal command_call_count
280 nonlocal in_use
281 if in_use is True:
282 raise ValueError("Commands should be executed one at a time.")
283 in_use = True
284 await asyncio.sleep(0.01)
285 command_call_count += 1
286 await asyncio.sleep(0.03)
287 in_use = False
288 return "foo"
289
290 mock_conn = mock.AsyncMock(spec=Connection)
291 mock_conn.retry = Retry_()

Callers 2

re_auth_callbackMethod · 0.45
re_auth_callbackMethod · 0.45

Calls 1

sleepMethod · 0.45

Tested by

no test coverage detected