Skip to content

Commit

Permalink
Don't run conn sweeper if the pool only has one conn.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jul 11, 2022
1 parent 8b1d001 commit 99fb02a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func New(o Opt) (*Pool, error) {
}

// Start the idle connection sweeper.
if o.IdleTimeout.Seconds() >= 1 {
if o.IdleTimeout.Seconds() >= 1 && o.MaxConns > 1 {
go p.sweepConns(time.Second * 2)
}
return p, nil
Expand Down

0 comments on commit 99fb02a

Please sign in to comment.