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

Method SSubscribe

ring.go:705–715  ·  view source on GitHub ↗

SSubscribe Subscribes the client to the specified shard channels.

(ctx context.Context, channels ...string)

Source from the content-addressed store, hash-verified

703
704// SSubscribe Subscribes the client to the specified shard channels.
705func (c *Ring) SSubscribe(ctx context.Context, channels ...string) *PubSub {
706 if len(channels) == 0 {
707 panic("at least one channel is required")
708 }
709 shard, err := c.sharding.GetByKey(channels[0])
710 if err != nil {
711 // TODO: return PubSub with sticky error
712 panic(err)
713 }
714 return shard.Client.SSubscribe(ctx, channels...)
715}
716
717func (c *Ring) OnNewNode(fn func(rdb *Client)) {
718 c.sharding.OnNewNode(fn)

Callers

nothing calls this directly

Calls 2

GetByKeyMethod · 0.80
SSubscribeMethod · 0.65

Tested by

no test coverage detected