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

Method Channel

pubsub.go:572–582  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Channel returns a Go channel for concurrently receiving messages. The channel is closed together with the PubSub. If the Go channel is blocked full for 1 minute the message is dropped. Receive* APIs can not be used after

(opts ...ChannelOption)

Source from the content-addressed store, hash-verified

570// go-redis periodically sends ping messages to test connection health
571// and re-subscribes if ping can not received for 1 minute.
572func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message {
573 c.chOnce.Do(func() {
574 c.msgCh = newChannel(c, opts...)
575 c.msgCh.initMsgChan()
576 })
577 if c.msgCh == nil {
578 err := fmt.Errorf("redis: Channel can't be called after ChannelWithSubscriptions")
579 panic(err)
580 }
581 return c.msgCh.msgCh
582}
583
584// ChannelSize is like Channel, but creates a Go channel
585// with specified buffer size.

Callers 8

ChannelSizeMethod · 0.95
pubsub_test.goFile · 0.80
sentinel_test.goFile · 0.80
ExamplePubSubFunction · 0.80
race_test.goFile · 0.80
listenMethod · 0.80
subscribeFunction · 0.80
startPubSubConnectionsFunction · 0.80

Calls 3

newChannelFunction · 0.85
initMsgChanMethod · 0.80
DoMethod · 0.65

Tested by 2

ExamplePubSubFunction · 0.64
startPubSubConnectionsFunction · 0.64