Skip to content

Commit

Permalink
Merge pull request #433 from redis/fix-zpopmax-count
Browse files Browse the repository at this point in the history
fix: rueidiscompat's ZPopMax and ZPopMin with count 1
  • Loading branch information
rueian authored Dec 23, 2023
2 parents 0249ec8 + a81d7e4 commit 3ec15df
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rueidiscompat/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2028,9 +2028,7 @@ func (c *Compat) ZPopMax(ctx context.Context, key string, count ...int64) *ZSlic
resp = c.client.Do(ctx, c.client.B().Zpopmax().Key(key).Build())
case 1:
resp = c.client.Do(ctx, c.client.B().Zpopmax().Key(key).Count(count[0]).Build())
if count[0] > 1 {
return newZSliceCmd(resp)
}
return newZSliceCmd(resp)
default:
panic("too many arguments")
}
Expand All @@ -2044,9 +2042,7 @@ func (c *Compat) ZPopMin(ctx context.Context, key string, count ...int64) *ZSlic
resp = c.client.Do(ctx, c.client.B().Zpopmin().Key(key).Build())
case 1:
resp = c.client.Do(ctx, c.client.B().Zpopmin().Key(key).Count(count[0]).Build())
if count[0] > 1 {
return newZSliceCmd(resp)
}
return newZSliceCmd(resp)
default:
panic("too many arguments")
}
Expand Down

0 comments on commit 3ec15df

Please sign in to comment.