1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add NewFailoverClusterClient

This commit is contained in:
Ehsan Afzali
2020-09-09 15:27:17 +03:00
committed by Vladimir Mihailenco
parent b273d2bf57
commit 6c85ee767a
6 changed files with 190 additions and 43 deletions

View File

@ -49,7 +49,7 @@ type ClusterOptions struct {
// and load-balance read/write operations between master and slaves.
// It can use service like ZooKeeper to maintain configuration information
// and Cluster.ReloadState to manually trigger state reloading.
ClusterSlots func() ([]ClusterSlot, error)
ClusterSlots func(context.Context) ([]ClusterSlot, error)
// Following options are copied from Options struct.
@ -987,7 +987,7 @@ func (c *ClusterClient) PoolStats() *PoolStats {
func (c *ClusterClient) loadState(ctx context.Context) (*clusterState, error) {
if c.opt.ClusterSlots != nil {
slots, err := c.opt.ClusterSlots()
slots, err := c.opt.ClusterSlots(ctx)
if err != nil {
return nil, err
}