Closed elrik75 closed 1 year ago
Hey! Are you sure that this is the reason for 100% CPU usage? I mean, there's an await
inside the loop, so it shouldn't be blocked.
Hey! Are you sure that this is the reason for 100% CPU usage? I mean, there's an
await
inside the loop, so it shouldn't be blocked.
Not sure for the other coroutines (but mine are never executed). Maybe there is a race to be called by the scheduler. But this code is run as fast as possible and I'm pretty sure it's the cause of the 100% CPU.
edit: with the sleep(1)
, my other coroutines start and CPU is fine.
When a node is down and you start your app with a PoolManager,
self._check_pool_task()
is called inself.__init__()
for each dsn, and thenself._wait_creating_pool()
. If a node is down then_wait_creating_pool()
enters in an infinite loop, that's normal but this loop must retry smoothly to avoid 100% CPU and other coroutines to be scheduled.Here a proposition:
tested on: Linux + PG 15 + asyncpg 0.27.0 + hasql 0.5.10