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

Method WithReader

internal/pool/conn.go:890–908  ·  internal/pool/conn.go::Conn.WithReader
(
	ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error,
)

Source from the content-addressed store, hash-verified

888}
889
890func (cn *Conn) WithReader(
891 ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error,
892) error {
893 if timeout >= 0 {
894 // Use relaxed timeout if set, otherwise use provided timeout
895 effectiveTimeout := cn.getEffectiveReadTimeout(timeout)
896
897 // Get the connection directly from atomic storage
898 netConn := cn.getNetConn()
899 if netConn == nil {
900 return errConnectionNotAvailable
901 }
902
903 if err := netConn.SetReadDeadline(cn.deadline(ctx, effectiveTimeout)); err != nil {
904 return err
905 }
906 }
907 return fn(cn.rd)
908}
909
910func (cn *Conn) WithWriter(
911 ctx context.Context, timeout time.Duration, fn func(wr *proto.Writer) error,

Callers 14

TestConn_UsedAtPrecisionFunction · 0.95
_processMethod · 0.80
pipelineProcessCmdsMethod · 0.80
txPipelineProcessCmdsMethod · 0.80
ReceiveTimeoutMethod · 0.80
mainFunction · 0.80

Calls 4

getNetConnMethod · 0.95
deadlineMethod · 0.95
SetReadDeadlineMethod · 0.45