MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _wait

Method _wait

asyncpg/_testbase/fuzzer.py:40–57  ·  view source on GitHub ↗
(self, work)

Source from the content-addressed store, hash-verified

38 self.connection_factory = Connection
39
40 async def _wait(self, work):
41 work_task = asyncio.ensure_future(work)
42 stop_event_task = asyncio.ensure_future(self.stop_event.wait())
43
44 try:
45 await asyncio.wait(
46 [work_task, stop_event_task],
47 return_when=asyncio.FIRST_COMPLETED)
48
49 if self.stop_event.is_set():
50 raise StopServer()
51 else:
52 return work_task.result()
53 finally:
54 if not work_task.done():
55 work_task.cancel()
56 if not stop_event_task.done():
57 stop_event_task.cancel()
58
59 def start(self):
60 started = threading.Event()

Callers 1

listenMethod · 0.95

Calls 3

StopServerClass · 0.85
waitMethod · 0.80
cancelMethod · 0.45

Tested by

no test coverage detected