Skip to content

Commit 871315e

Browse files
committed
diagnose time spent waiting for a connection from the pool
1 parent d54e848 commit 871315e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/pool/pool.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ func (p *ConnPool) waitTurn(ctx context.Context) error {
314314
default:
315315
}
316316

317+
start := time.Now()
318+
defer func() {
319+
ctx.Value("connectionQueueTimes").(chan<- time.Duration) <- time.Since(start)
320+
}()
321+
317322
select {
318323
case p.queue <- struct{}{}:
319324
return nil

0 commit comments

Comments
 (0)