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

Method worker

tests/test_connect.py:1968–1975  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1966 ssl=ssl_context)
1967
1968 async def worker():
1969 async with pool.acquire() as con:
1970 self.assertEqual(await con.fetchval('SELECT 42'), 42)
1971
1972 with self.assertRaises(asyncio.TimeoutError):
1973 await con.execute('SELECT pg_sleep(5)', timeout=0.5)
1974
1975 self.assertEqual(await con.fetchval('SELECT 43'), 43)
1976
1977 tasks = [worker() for _ in range(100)]
1978 await asyncio.gather(*tasks)

Callers

nothing calls this directly

Calls 3

acquireMethod · 0.45
fetchvalMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected