MCPcopy
hub / github.com/redis/go-redis / releaseConn

Method releaseConn

redis.go:798–812  ·  redis.go::baseClient.releaseConn
(ctx context.Context, cn *pool.Conn, err error)

Source from the content-addressed store, hash-verified

796}
797
798func (c *baseClient) releaseConn(ctx context.Context, cn *pool.Conn, err error) {
799 if c.opt.Limiter != nil {
800 c.opt.Limiter.ReportResult(err)
801 }
802
803 if isBadConn(err, false, c.opt.Addr) {
804 c.connPool.Remove(ctx, cn, err)
805 } else {
806 // process any pending push notifications before returning the connection to the pool
807 if err := c.processPushNotifications(ctx, cn); err != nil {
808 internal.Logger.Printf(ctx, "push: error processing pending notifications before releasing connection: %v", err)
809 }
810 c.connPool.Put(ctx, cn)
811 }
812}
813
814func (c *baseClient) withConn(
815 ctx context.Context, fn func(context.Context, *pool.Conn) error,

Callers 1

withConnMethod · 0.95

Calls 6

isBadConnFunction · 0.85
ReportResultMethod · 0.80
RemoveMethod · 0.65
PrintfMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected