mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
chore: remove unused param (#3382)
* chore: remove unused param Signed-off-by: fukua95 <fukua95@gmail.com> * chore: rename a unused param to `_` Signed-off-by: fukua95 <fukua95@gmail.com> --------- Signed-off-by: fukua95 <fukua95@gmail.com>
This commit is contained in:
@ -364,14 +364,14 @@ var _ = Describe("ClusterClient", func() {
|
|||||||
It("select slot from args for GETKEYSINSLOT command", func() {
|
It("select slot from args for GETKEYSINSLOT command", func() {
|
||||||
cmd := NewStringSliceCmd(ctx, "cluster", "getkeysinslot", 100, 200)
|
cmd := NewStringSliceCmd(ctx, "cluster", "getkeysinslot", 100, 200)
|
||||||
|
|
||||||
slot := client.cmdSlot(context.Background(), cmd)
|
slot := client.cmdSlot(cmd)
|
||||||
Expect(slot).To(Equal(100))
|
Expect(slot).To(Equal(100))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("select slot from args for COUNTKEYSINSLOT command", func() {
|
It("select slot from args for COUNTKEYSINSLOT command", func() {
|
||||||
cmd := NewStringSliceCmd(ctx, "cluster", "countkeysinslot", 100)
|
cmd := NewStringSliceCmd(ctx, "cluster", "countkeysinslot", 100)
|
||||||
|
|
||||||
slot := client.cmdSlot(context.Background(), cmd)
|
slot := client.cmdSlot(cmd)
|
||||||
Expect(slot).To(Equal(100))
|
Expect(slot).To(Equal(100))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -981,7 +981,7 @@ func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
|
func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
|
||||||
slot := c.cmdSlot(ctx, cmd)
|
slot := c.cmdSlot(cmd)
|
||||||
var node *clusterNode
|
var node *clusterNode
|
||||||
var moved bool
|
var moved bool
|
||||||
var ask bool
|
var ask bool
|
||||||
@ -1329,7 +1329,7 @@ func (c *ClusterClient) mapCmdsByNode(ctx context.Context, cmdsMap *cmdsMap, cmd
|
|||||||
|
|
||||||
if c.opt.ReadOnly && c.cmdsAreReadOnly(ctx, cmds) {
|
if c.opt.ReadOnly && c.cmdsAreReadOnly(ctx, cmds) {
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
slot := c.cmdSlot(ctx, cmd)
|
slot := c.cmdSlot(cmd)
|
||||||
node, err := c.slotReadOnlyNode(state, slot)
|
node, err := c.slotReadOnlyNode(state, slot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1340,7 +1340,7 @@ func (c *ClusterClient) mapCmdsByNode(ctx context.Context, cmdsMap *cmdsMap, cmd
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
slot := c.cmdSlot(ctx, cmd)
|
slot := c.cmdSlot(cmd)
|
||||||
node, err := state.slotMasterNode(slot)
|
node, err := state.slotMasterNode(slot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1540,7 +1540,7 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
|
|||||||
func (c *ClusterClient) mapCmdsBySlot(ctx context.Context, cmds []Cmder) map[int][]Cmder {
|
func (c *ClusterClient) mapCmdsBySlot(ctx context.Context, cmds []Cmder) map[int][]Cmder {
|
||||||
cmdsMap := make(map[int][]Cmder)
|
cmdsMap := make(map[int][]Cmder)
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
slot := c.cmdSlot(ctx, cmd)
|
slot := c.cmdSlot(cmd)
|
||||||
cmdsMap[slot] = append(cmdsMap[slot], cmd)
|
cmdsMap[slot] = append(cmdsMap[slot], cmd)
|
||||||
}
|
}
|
||||||
return cmdsMap
|
return cmdsMap
|
||||||
@ -1569,7 +1569,7 @@ func (c *ClusterClient) processTxPipelineNode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClusterClient) processTxPipelineNodeConn(
|
func (c *ClusterClient) processTxPipelineNodeConn(
|
||||||
ctx context.Context, node *clusterNode, cn *pool.Conn, cmds []Cmder, failedCmds *cmdsMap,
|
ctx context.Context, _ *clusterNode, cn *pool.Conn, cmds []Cmder, failedCmds *cmdsMap,
|
||||||
) error {
|
) error {
|
||||||
if err := cn.WithWriter(c.context(ctx), c.opt.WriteTimeout, func(wr *proto.Writer) error {
|
if err := cn.WithWriter(c.context(ctx), c.opt.WriteTimeout, func(wr *proto.Writer) error {
|
||||||
return writeCmds(wr, cmds)
|
return writeCmds(wr, cmds)
|
||||||
@ -1858,7 +1858,7 @@ func (c *ClusterClient) cmdInfo(ctx context.Context, name string) *CommandInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClusterClient) cmdSlot(ctx context.Context, cmd Cmder) int {
|
func (c *ClusterClient) cmdSlot(cmd Cmder) int {
|
||||||
args := cmd.Args()
|
args := cmd.Args()
|
||||||
if args[0] == "cluster" && (args[1] == "getkeysinslot" || args[1] == "countkeysinslot") {
|
if args[0] == "cluster" && (args[1] == "getkeysinslot" || args[1] == "countkeysinslot") {
|
||||||
return args[2].(int)
|
return args[2].(int)
|
||||||
|
Reference in New Issue
Block a user