Skip to content

Default MaxIdleConnections to 2 when unset - #271

Open
Hashim1999164 wants to merge 1 commit into
dropbox:masterfrom
Hashim1999164:fix/default-max-idle-connections
Open

Default MaxIdleConnections to 2 when unset#271
Hashim1999164 wants to merge 1 commit into
dropbox:masterfrom
Hashim1999164:fix/default-max-idle-connections

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

Fixes #261.

When MaxIdleConnections was left at the Go zero value, the idle pool never retained connections, so every Get dialed a new one. Unset now applies a default idle size of 2 so connections can be reused. An explicit positive value still controls the limit as before.

Test plan

  • go test ./net2/
  • Added TestDefaultMaxIdleConnections covering Get, Release, and reuse

The Go zero value left the idle pool empty, so every Get dialed a new connection. Unset now uses a small idle size so connections can be reused.
@CLAassistant

CLAassistant commented Aug 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default value of MaxIdleConnections in net2.ConnectionPool is extremely slow

2 participants