anna-money / asyncpg-listen

A thing to simplify listening for PG notifications with asyncpg
MIT License
37 stars 2 forks source link

Connection pool #153

Closed radical-squared closed 1 year ago

radical-squared commented 1 year ago

Many thanks for sharing and maintaining this valuable project. Is there a way to use the connect_func with a connection from a connection pool?

pgpool = await asyncpg.create_pool(dsn=myl_dsn)
async with pgpool.acquire() as connection: 
Pliner commented 1 year ago

Hi @radical-squared!

Many thanks for sharing and maintaining this valuable project.

Thanks :)

Is there a way to use the connect_func with a connection from a connection pool?

Connection pool is not used, because a connection here is long lived.

Even if a connection pool is used, one connection from the pool will be occupied and will never be returned back, which doesn't look like a good use case for the pool.

radical-squared commented 1 year ago

I see. Thanks for explaining that. The code is magic to me, but works like a charm. Happy holidays!