Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pgxpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type Pool struct {
healthCheckTimer *time.Timer

healthCheckChan chan struct{}
baseCtx context.Context

acquireTracer AcquireTracer
releaseTracer ReleaseTracer
Expand Down Expand Up @@ -250,6 +251,7 @@ func NewWithConfig(ctx context.Context, config *Config) (*Pool, error) {
healthCheckPeriod: config.HealthCheckPeriod,
healthCheckChan: make(chan struct{}, 1),
closeChan: make(chan struct{}),
baseCtx: context.WithoutCancel(ctx),
}

if t, ok := config.ConnConfig.Tracer.(AcquireTracer); ok {
Expand Down Expand Up @@ -561,7 +563,7 @@ func (p *Pool) checkMinConns() error {
stat := p.Stat()
toCreate := max(p.minConns-stat.TotalConns(), p.minIdleConns-stat.IdleConns())
if toCreate > 0 {
return p.createIdleResources(context.Background(), int(toCreate))
return p.createIdleResources(p.baseCtx, int(toCreate))
}
return nil
}
Expand Down
Loading