asynch icon indicating copy to clipboard operation
asynch copied to clipboard

Add connection validity check in acquire method

Open lxneng opened this issue 1 year ago • 3 comments

  • A new asynchronous method _check_conn is added to check the validity of the connection. This method is used in the acquire method to ensure only valid connections are acquired from the connection pool.
  • Change the condition in initialize method to check freesize instead of size.

lxneng avatar Oct 19 '23 01:10 lxneng

This is a good idea. I'd make it opt-in though.

SQLAlchemy uses the pool_pre_ping argument (default False) to enable this behaviour.

https://docs.sqlalchemy.org/en/20/core/pooling.html#disconnect-handling-pessimistic

itssimon avatar Mar 01 '24 23:03 itssimon

Thanks! Please resolve conflicts first.

long2ice avatar Apr 22 '24 07:04 long2ice

Thanks! Please resolve conflicts first.

@long2ice I have resolved all the conflicts. Please review this PR again. Thank you!

lxneng avatar May 21 '24 15:05 lxneng

Thanks!

long2ice avatar Jun 13 '24 09:06 long2ice