forked from mirror/redis
Added missing idle args in XPendingExtArgs (#1750)
Added missing idle args in XPendingExtArgs
This commit is contained in:
parent
44f5c06755
commit
31495ac570
|
@ -1811,6 +1811,7 @@ func (c cmdable) XPending(ctx context.Context, stream, group string) *XPendingCm
|
|||
type XPendingExtArgs struct {
|
||||
Stream string
|
||||
Group string
|
||||
Idle time.Duration
|
||||
Start string
|
||||
End string
|
||||
Count int64
|
||||
|
@ -1818,8 +1819,12 @@ type XPendingExtArgs struct {
|
|||
}
|
||||
|
||||
func (c cmdable) XPendingExt(ctx context.Context, a *XPendingExtArgs) *XPendingExtCmd {
|
||||
args := make([]interface{}, 0, 7)
|
||||
args = append(args, "xpending", a.Stream, a.Group, a.Start, a.End, a.Count)
|
||||
args := make([]interface{}, 0, 9)
|
||||
args = append(args, "xpending", a.Stream, a.Group)
|
||||
if a.Idle != 0 {
|
||||
args = append(args, "idle", formatMs(ctx, a.Idle))
|
||||
}
|
||||
args = append(args, a.Start, a.End, a.Count)
|
||||
if a.Consumer != "" {
|
||||
args = append(args, a.Consumer)
|
||||
}
|
||||
|
|
|
@ -4225,15 +4225,15 @@ var _ = Describe("Commands", func() {
|
|||
Higher: "3-0",
|
||||
Consumers: map[string]int64{"consumer": 3},
|
||||
}))
|
||||
|
||||
infoExt, err := client.XPendingExt(ctx, &redis.XPendingExtArgs{
|
||||
args := &redis.XPendingExtArgs{
|
||||
Stream: "stream",
|
||||
Group: "group",
|
||||
Start: "-",
|
||||
End: "+",
|
||||
Count: 10,
|
||||
Consumer: "consumer",
|
||||
}).Result()
|
||||
}
|
||||
infoExt, err := client.XPendingExt(ctx, args).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for i := range infoExt {
|
||||
infoExt[i].Idle = 0
|
||||
|
@ -4244,6 +4244,11 @@ var _ = Describe("Commands", func() {
|
|||
{ID: "3-0", Consumer: "consumer", Idle: 0, RetryCount: 1},
|
||||
}))
|
||||
|
||||
args.Idle = 72 * time.Hour
|
||||
infoExt, err = client.XPendingExt(ctx, args).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(infoExt).To(HaveLen(0))
|
||||
|
||||
n, err := client.XGroupDelConsumer(ctx, "stream", "group", "consumer").Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(n).To(Equal(int64(3)))
|
||||
|
|
Loading…
Reference in New Issue