aio-libs / aiopg

aiopg is a library for accessing a PostgreSQL database from the asyncio
http://aiopg.readthedocs.io
BSD 2-Clause "Simplified" License
1.39k stars 159 forks source link

Close connection when _fill_free_pool is cancelled. #893

Open iksteen opened 1 year ago

iksteen commented 1 year ago

Cancelling _fill_free_pool before a new connection is added to self._free prevents it from being cleaned up which causes a lingering connection and eventually the postgresql server running out of sockets.

What do these changes do?

Are there changes in behavior for the user?

Related issue number

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #893 (1f39c7c) into master (1ba66ca) will decrease coverage by 0.93%. The diff coverage is 20.00%.

@@            Coverage Diff             @@
##           master     #893      +/-   ##
==========================================
- Coverage   91.77%   90.83%   -0.94%     
==========================================
  Files           9        9              
  Lines         863      873      +10     
  Branches      118      121       +3     
==========================================
+ Hits          792      793       +1     
- Misses         53       61       +8     
- Partials       18       19       +1     
Impacted Files Coverage Δ
aiopg/pool.py 91.02% <20.00%> (-3.45%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more