Commit dfcb227b authored by Steve Webster's avatar Steve Webster
Browse files

Only increment delivery count if JUSTID option is omitted

parent f1e7df4b
...@@ -2279,10 +2279,11 @@ void xclaimCommand(client *c) { ...@@ -2279,10 +2279,11 @@ void xclaimCommand(client *c) {
/* Update the consumer and idle time. */ /* Update the consumer and idle time. */
nack->consumer = consumer; nack->consumer = consumer;
nack->delivery_time = deliverytime; nack->delivery_time = deliverytime;
/* Set the delivery attempts counter if given, otherwise autoincrement */ /* Set the delivery attempts counter if given, otherwise
* autoincrement unless JUSTID option provided */
if (retrycount >= 0) { if (retrycount >= 0) {
nack->delivery_count = retrycount; nack->delivery_count = retrycount;
} else { } else if (!justid) {
nack->delivery_count++; nack->delivery_count++;
} }
/* Add the entry in the new consumer local PEL. */ /* Add the entry in the new consumer local PEL. */
......
...@@ -195,7 +195,7 @@ start_server { ...@@ -195,7 +195,7 @@ start_server {
assert_equal "" [lindex $reply 0] assert_equal "" [lindex $reply 0]
} }
test {XCLAIM increments delivery count} { test {XCLAIM without JUSTID increments delivery count} {
# Add 3 items into the stream, and create a consumer group # Add 3 items into the stream, and create a consumer group
r del mystream r del mystream
set id1 [r XADD mystream * a 1] set id1 [r XADD mystream * a 1]
...@@ -222,6 +222,20 @@ start_server { ...@@ -222,6 +222,20 @@ start_server {
] ]
assert {[llength [lindex $reply 0]] == 4} assert {[llength [lindex $reply 0]] == 4}
assert {[lindex $reply 0 3] == 2} assert {[lindex $reply 0 3] == 2}
# Client 3 then claims pending item 1 from the PEL of client 2 using JUSTID
r debug sleep 0.2
set reply [
r XCLAIM mystream mygroup client3 10 $id1 JUSTID
]
assert {[llength $reply] == 1}
assert {[lindex $reply 0] eq $id1}
set reply [
r XPENDING mystream mygroup - + 10
]
assert {[llength [lindex $reply 0]] == 4}
assert {[lindex $reply 0 3] == 2}
} }
start_server {} { start_server {} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment