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) {
/* Update the consumer and idle time. */
nack->consumer = consumer;
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) {
nack->delivery_count = retrycount;
} else {
} else if (!justid) {
nack->delivery_count++;
}
/* Add the entry in the new consumer local PEL. */
......
......@@ -195,7 +195,7 @@ start_server {
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
r del mystream
set id1 [r XADD mystream * a 1]
......@@ -222,6 +222,20 @@ start_server {
]
assert {[llength [lindex $reply 0]] == 4}
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 {} {
......
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