You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import asyncdispatch, asyncpg/asyncpg
constPOOL_SIZE=5var pool =newPool(POOL_SIZE)
procmain() {.async.} =var start: floatvar connStr ="host=localhost port=5432 dbname=test user="await pool.connect(connStr)
var futures =newSeq[Future[apgResult]]()
for i in0..<10:
futures.addexec(pool, "SELECT $1, pg_sleep(1);", i)
var results =awaitall(futures)
for res in results:
for item in res[0].rows():
echo item, ""waitFormain()
Starts 10 connections that sleep for 10 seconds. If pool size is less the number of connections strange error happens:
asyncpgtest.nim(18) asyncpgtest
asyncdispatch.nim(1654) waitFor
asyncdispatch.nim(1514) poll
asyncdispatch.nim(1233) runOnce
Error: unhandled exception: No handles or timers registered in dispatcher. [ValueError]
I think if connections are not available it should error out or wait some how. I think it just forgets to register no available connection case.
Pool size of 10 works, pool size of 5 does not.
Starts 10 connections that sleep for 10 seconds. If pool size is less the number of connections strange error happens:
I think if connections are not available it should error out or wait some how. I think it just forgets to register no available connection case.
The text was updated successfully, but these errors were encountered: