Open a791446794 opened 9 months ago
Scan command in pipeline cause infinite loop
Scan command return an iterator, then invoke iterator.Next(ctx) should forward scan cursor.
block at iterator.Next()
ctx := context.Background() var cmd *redis.ScanCmd cmds, err := rdb.Pipelined(ctx, func(pipeliner redis.Pipeliner) error { _ = pipeliner.Scan(ctx, 0, "som:key:*", 1000) return nil }) cmd = cmds[0].(*redis.ScanCmd) if err != nil { t.Error(cmd.Err()) return } var cnt = 1 iter := cmd.Iterator() var keys []string for { val := iter.Val() if val != "" { keys = append(keys, val) } if !iter.Next(ctx) { // infinite loop here break } if iter.Err() != nil { t.Error(iter.Err()) return } cnt++ } t.Logf("cnt:%d,result, len(%d):\n%s", cnt, len(keys), strings.Join(keys, "\n"))
redis/v9
Scan command in pipeline cause infinite loop
Expected Behavior
Scan command return an iterator, then invoke iterator.Next(ctx) should forward scan cursor.
Current Behavior
block at iterator.Next()
Possible Solution
Steps to Reproduce
Context (Environment)
redis/v9
Detailed Description
Possible Implementation