Skip to content

Conversation

@1st1
Copy link
Member

@1st1 1st1 commented Mar 29, 2017

Make internal connection pool queue reference a new intermediate
object -- PoolConnectionHolder -- instead of Connections directly.

PoolConnectionHolder fully encapsulates the management of one
connection:

  • connection logic;
  • handling closed connections;
  • handling connections that exceeded max-queries quota; etc.

The new logic guarantees that old and new connections are always
added back to the pool (1), removes a deadlock in pool.acquire (2),
uses a LIFO queue to take advantage of "min_size" pool parameter.

@1st1 1st1 requested a review from elprans March 29, 2017 21:45
@1st1 1st1 force-pushed the new_pool branch 8 times, most recently from 8e3e355 to 367a769 Compare March 29, 2017 23:01
asyncpg/pool.py Outdated
self._setup = setup
self._init = init

async def connect(self, *, queue=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove queue

Make internal connection pool queue reference a new intermediate object -- PoolConnectionHolder -- instead of Connections directly. PoolConnectionHolder fully encapsulates the management of one connection: * connection logic; * handling closed connections; * handling connections that exceeded max-queries quota; etc. The new logic guarantees that old and new connections are always added back to the pool (1), removes a deadlock in pool.acquire (2), uses a LIFO queue to take advantage of "min_size" pool parameter (3).
@1st1 1st1 merged commit d1ee90e into master Mar 30, 2017
@1st1 1st1 deleted the new_pool branch March 30, 2017 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants