Skip to content

Commit ac79167

Browse files
authored
fix: Add small timeout to monitor (#1718)
Signed-off-by: Vladislav Oleshko <[email protected]>
1 parent cfc04cf commit ac79167

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/dragonfly/connection_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ async def start(self):
4040
self._monitor_task = asyncio.create_task(self._monitor())
4141
await asyncio.sleep(0.1)
4242

43-
async def stop(self):
43+
async def stop(self, timeout=0.1):
4444
if self._monitor_task:
45+
# Wait for Dragonfly to send all async monitor messages
46+
await asyncio.sleep(timeout)
4547
self._monitor_task.cancel()
4648
try:
4749
await self._monitor_task
@@ -98,7 +100,7 @@ async def test_monitor_command_multi(async_pool):
98100

99101
await p.execute()
100102

101-
collected = await monitor.stop()
103+
collected = await monitor.stop(0.3)
102104
expected = CollectedRedisMsg.all_from_src(*expected)
103105

104106
# The order is random due to squashing

0 commit comments

Comments
 (0)