diff --git a/internal/pool/pool.go b/internal/pool/pool.go index b69c75f4f0..fbeaa2a45d 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -314,6 +314,16 @@ func (p *ConnPool) waitTurn(ctx context.Context) error { default: } + start := time.Now() + defer func() { + if c, found := ctx.Value("connectionQueueTimes").(chan<- time.Duration); found { + select { + case c <- time.Since(start): + default: // prevent a full buffer from freezing the application + } + } + }() + select { case p.queue <- struct{}{}: return nil