@@ -256,7 +256,6 @@ cdef class BaseThinPoolImpl(BasePoolImpl):
256
256
Called when a new connection is created on acquire with the lock held.
257
257
"""
258
258
if orig_conn_impl is not None :
259
- self ._busy_conn_impls.remove(orig_conn_impl)
260
259
self ._busy_conn_impls.append(new_conn_impl)
261
260
else :
262
261
new_conn_impl._is_pool_extra = True
@@ -621,7 +620,6 @@ cdef class ThinPoolImpl(BaseThinPoolImpl):
621
620
temp_conn_impl = None
622
621
break
623
622
temp_conn_impl = < ThinConnImpl> result
624
- self ._busy_conn_impls.append(temp_conn_impl)
625
623
if must_reconnect:
626
624
break
627
625
@@ -630,9 +628,11 @@ cdef class ThinPoolImpl(BaseThinPoolImpl):
630
628
if requires_ping:
631
629
try :
632
630
temp_conn_impl.ping()
633
- except exceptions.DatabaseError :
631
+ except exceptions.Error :
634
632
temp_conn_impl._force_close()
635
633
if temp_conn_impl._protocol._transport is not None :
634
+ with self ._condition:
635
+ self ._busy_conn_impls.append(temp_conn_impl)
636
636
return temp_conn_impl
637
637
638
638
# a new connection needs to be created
@@ -710,7 +710,6 @@ cdef class AsyncThinPoolImpl(BaseThinPoolImpl):
710
710
temp_conn_impl = None
711
711
break
712
712
temp_conn_impl = < AsyncThinConnImpl> result
713
- self ._busy_conn_impls.append(temp_conn_impl)
714
713
if must_reconnect:
715
714
break
716
715
@@ -719,9 +718,11 @@ cdef class AsyncThinPoolImpl(BaseThinPoolImpl):
719
718
if requires_ping:
720
719
try :
721
720
await temp_conn_impl.ping()
722
- except exceptions.DatabaseError :
721
+ except exceptions.Error :
723
722
temp_conn_impl._force_close()
724
723
if temp_conn_impl._protocol._transport is not None :
724
+ async with self ._condition:
725
+ self ._busy_conn_impls.append(temp_conn_impl)
725
726
return temp_conn_impl
726
727
727
728
# a new connection needs to be created
0 commit comments