Skip to content

Commit

Permalink
update idle count on changing pool capacity after the capacity is app…
Browse files Browse the repository at this point in the history
…lied to the pool

Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Jan 7, 2025
1 parent 6ceefe8 commit b1c9b18
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/pools/smartconnpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ func (pool *ConnPool[C]) setCapacity(ctx context.Context, newcap int64) error {
if oldcap == newcap {
return nil
}
pool.setIdleCount()
// update the idle count to match the new capacity if necessary
// wait for connections to be returned to the pool if we're reducing the capacity.
defer pool.setIdleCount()

const delay = 10 * time.Millisecond

Expand Down

0 comments on commit b1c9b18

Please sign in to comment.