@@ -604,11 +604,10 @@ func (p *Pool) MExpire(ctx context.Context, expiration time.Duration, keys ...st
604
604
var wg sync.WaitGroup
605
605
var mu sync.Mutex
606
606
var results []redis.Cmder
607
- var i int
608
607
for ind , keys := range index2Keys {
609
608
wg .Add (1 )
610
609
conn , _ := factory .shards [ind ].getMasterConn ()
611
- go func (i int , conn * redis.Client , keys ... string ) {
610
+ go func (conn * redis.Client , keys ... string ) {
612
611
pipe := conn .Pipeline ()
613
612
for _ , key := range keys {
614
613
pipe .Expire (ctx , key , expiration )
@@ -623,8 +622,7 @@ func (p *Pool) MExpire(ctx context.Context, expiration time.Duration, keys ...st
623
622
mu .Unlock ()
624
623
}
625
624
wg .Done ()
626
- }(i , conn , keys ... )
627
- i ++
625
+ }(conn , keys ... )
628
626
}
629
627
wg .Wait ()
630
628
@@ -689,11 +687,10 @@ func (p *Pool) MExpireAt(ctx context.Context, tm time.Time, keys ...string) map[
689
687
var wg sync.WaitGroup
690
688
var mu sync.Mutex
691
689
var results []redis.Cmder
692
- var i int
693
690
for ind , keys := range index2Keys {
694
691
wg .Add (1 )
695
692
conn , _ := factory .shards [ind ].getMasterConn ()
696
- go func (i int , conn * redis.Client , keys ... string ) {
693
+ go func (conn * redis.Client , keys ... string ) {
697
694
pipe := conn .Pipeline ()
698
695
for _ , key := range keys {
699
696
pipe .ExpireAt (ctx , key , tm )
@@ -708,8 +705,7 @@ func (p *Pool) MExpireAt(ctx context.Context, tm time.Time, keys ...string) map[
708
705
mu .Unlock ()
709
706
}
710
707
wg .Done ()
711
- }(i , conn , keys ... )
712
- i ++
708
+ }(conn , keys ... )
713
709
}
714
710
wg .Wait ()
715
711
0 commit comments