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

Method resubscribe

pubsub.go:122–144  ·  view source on GitHub ↗
(ctx context.Context, cn *pool.Conn)

Source from the content-addressed store, hash-verified

120}
121
122func (c *PubSub) resubscribe(ctx context.Context, cn *pool.Conn) error {
123 var firstErr error
124
125 if len(c.channels) > 0 {
126 firstErr = c._subscribe(ctx, cn, "subscribe", slices.Collect(maps.Keys(c.channels)))
127 }
128
129 if len(c.patterns) > 0 {
130 err := c._subscribe(ctx, cn, "psubscribe", slices.Collect(maps.Keys(c.patterns)))
131 if err != nil && firstErr == nil {
132 firstErr = err
133 }
134 }
135
136 if len(c.schannels) > 0 {
137 err := c._subscribe(ctx, cn, "ssubscribe", slices.Collect(maps.Keys(c.schannels)))
138 if err != nil && firstErr == nil {
139 firstErr = err
140 }
141 }
142
143 return firstErr
144}
145
146func (c *PubSub) _subscribe(
147 ctx context.Context, cn *pool.Conn, redisCmd string, channels []string,

Callers 1

connMethod · 0.95

Calls 3

_subscribeMethod · 0.95
CollectMethod · 0.80
KeysMethod · 0.65

Tested by

no test coverage detected