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
I have an application that should never exhaust its connection pool.
If it does, I would like to print a warning.
Is there a way of doing determining if the pool is exhausted other than polling the pool size?
Is is correct way to determine if the pool is exhausted exhausted = _pool.get_max_size() - self._pool.get_size() - self._pool.get_idle_size() == 0 or should I just do exhausted = not(_pool._queue),
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an application that should never exhaust its connection pool.
If it does, I would like to print a warning.
exhausted = _pool.get_max_size() - self._pool.get_size() - self._pool.get_idle_size() == 0
or should I just doexhausted = not(_pool._queue)
,One way of implementing this would be to check if the queue is empty here before calling get() here https://github.com/MagicStack/asyncpg/blob/master/asyncpg/pool.py#L828 and incrementing a counter if it is empty.
It would not be 100% correct, I assume, but it would still be more accurate then polling?
Beta Was this translation helpful? Give feedback.
All reactions