@@ -3,7 +3,6 @@ package pool
3
3
import (
4
4
"context"
5
5
"errors"
6
- "log"
7
6
"net"
8
7
"sync"
9
8
"sync/atomic"
@@ -386,7 +385,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
386
385
attempts := 0
387
386
for {
388
387
if attempts >= getAttempts {
389
- log . Printf ("redis: connection pool: failed to get a connection accepted by hook after %d attempts" , attempts )
388
+ internal . Logger . Printf (ctx , "redis: connection pool: failed to get a connection accepted by hook after %d attempts" , attempts )
390
389
break
391
390
}
392
391
attempts ++
@@ -416,7 +415,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
416
415
417
416
if hookManager != nil {
418
417
if err := hookManager .ProcessOnGet (ctx , cn , false ); err != nil {
419
- log . Printf ("redis: connection pool: failed to process idle connection by hook: %v" , err )
418
+ internal . Logger . Printf (ctx , "redis: connection pool: failed to process idle connection by hook: %v" , err )
420
419
// Failed to process connection, discard it
421
420
_ = p .CloseConn (cn )
422
421
continue
@@ -443,7 +442,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
443
442
if hookManager != nil {
444
443
if err := hookManager .ProcessOnGet (ctx , newcn , true ); err != nil {
445
444
// Failed to process connection, discard it
446
- log . Printf ("redis: connection pool: failed to process new connection by hook: %v" , err )
445
+ internal . Logger . Printf (ctx , "redis: connection pool: failed to process new connection by hook: %v" , err )
447
446
_ = p .CloseConn (newcn )
448
447
return nil , err
449
448
}
@@ -539,7 +538,7 @@ func (p *ConnPool) popIdle() (*Conn, error) {
539
538
540
539
// If we exhausted all attempts without finding a usable connection, return nil
541
540
if attempts >= popAttempts {
542
- log . Printf ("redis: connection pool: failed to get a usable connection after %d attempts" , popAttempts )
541
+ internal . Logger . Printf (context . Background (), "redis: connection pool: failed to get a usable connection after %d attempts" , popAttempts )
543
542
return nil , nil
544
543
}
545
544
@@ -764,5 +763,3 @@ func (p *ConnPool) isHealthyConn(cn *Conn, now time.Time) bool {
764
763
}
765
764
return true
766
765
}
767
-
768
-
0 commit comments