MCPcopy
hub / github.com/psycopg/psycopg / worker

Function worker

tests/pool/test_pool_common_async.py:176–183  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

174@pytest.mark.crdb_skip("backend pid")
175async def test_queue(pool_cls, dsn):
176 async def worker(n):
177 t0 = time()
178 async with p.connection() as conn:
179 assert conn._pool is p
180 await conn.execute("select pg_sleep(0.2)")
181 pid = conn.info.backend_pid
182 t1 = time()
183 results.append((n, t1 - t0, pid))
184
185 results: list[tuple[int, float, int]] = []
186 async with pool_cls(dsn, min_size=min_size(pool_cls, 2), max_size=2) as p:

Callers

nothing calls this directly

Calls 6

asleepFunction · 0.50
connectionMethod · 0.45
executeMethod · 0.45
setMethod · 0.45
infoMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected