mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Use consistent cluster state when executing pipeline.
This commit is contained in:
@ -17,3 +17,18 @@ func (c *PubSub) Pool() pool.Pooler {
|
||||
func (c *PubSub) ReceiveMessageTimeout(timeout time.Duration) (*Message, error) {
|
||||
return c.receiveMessage(timeout)
|
||||
}
|
||||
|
||||
func (c *ClusterClient) SlotAddrs(slot int) []string {
|
||||
var addrs []string
|
||||
for _, n := range c.state().slotNodes(slot) {
|
||||
addrs = append(addrs, n.Client.getAddr())
|
||||
}
|
||||
return addrs
|
||||
}
|
||||
|
||||
// SwapSlot swaps a slot's master/slave address for testing MOVED redirects.
|
||||
func (c *ClusterClient) SwapSlotNodes(slot int) []string {
|
||||
nodes := c.state().slots[slot]
|
||||
nodes[0], nodes[1] = nodes[1], nodes[0]
|
||||
return c.SlotAddrs(slot)
|
||||
}
|
||||
|
Reference in New Issue
Block a user