@@ -86,6 +86,12 @@ type Pooler interface {
8686 AddPoolHook (hook PoolHook )
8787 RemovePoolHook (hook PoolHook )
8888
89+ // RemoveWithoutTurn removes a connection from the pool without freeing a turn.
90+ // This should be used when removing a connection from a context that didn't acquire
91+ // a turn via Get() (e.g., background workers, cleanup tasks).
92+ // For normal removal after Get(), use Remove() instead.
93+ RemoveWithoutTurn (context.Context , * Conn , error )
94+
8995 Close () error
9096}
9197
@@ -163,10 +169,10 @@ func NewConnPool(opt *Options) *ConnPool {
163169 //semSize = opt.PoolSize
164170
165171 p := & ConnPool {
166- cfg : opt ,
167- semaphore : internal .NewFastSemaphore (semSize ),
172+ cfg : opt ,
173+ semaphore : internal .NewFastSemaphore (semSize ),
168174 queue : make (chan struct {}, opt .PoolSize ),
169- conns : make (map [uint64 ]* Conn ),
175+ conns : make (map [uint64 ]* Conn ),
170176 dialsInProgress : make (chan struct {}, opt .MaxConcurrentDials ),
171177 dialsQueue : newWantConnQueue (),
172178 idleConns : make ([]* Conn , 0 , opt .PoolSize ),
0 commit comments