summaryrefslogtreecommitdiffstats
path: root/tests/unit/type/stream-cgroups.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/type/stream-cgroups.tcl')
-rw-r--r--tests/unit/type/stream-cgroups.tcl30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl
index a6cc5da..46e0b05 100644
--- a/tests/unit/type/stream-cgroups.tcl
+++ b/tests/unit/type/stream-cgroups.tcl
@@ -475,7 +475,7 @@ start_server {
$rd close
}
- test {Blocking XREADGROUP for stream key that has clients blocked on list - avoid endless loop} {
+ test {Blocking XREADGROUP for stream key that has clients blocked on stream - avoid endless loop} {
r DEL mystream
r XGROUP CREATE mystream mygroup $ MKSTREAM
@@ -498,6 +498,34 @@ start_server {
assert_equal [r ping] {PONG}
}
+ test {Blocking XREADGROUP for stream key that has clients blocked on stream - reprocessing command} {
+ r DEL mystream
+ r XGROUP CREATE mystream mygroup $ MKSTREAM
+
+ set rd1 [redis_deferring_client]
+ set rd2 [redis_deferring_client]
+
+ $rd1 xreadgroup GROUP mygroup myuser BLOCK 0 STREAMS mystream >
+ wait_for_blocked_clients_count 1
+
+ set start [clock milliseconds]
+ $rd2 xreadgroup GROUP mygroup myuser BLOCK 1000 STREAMS mystream >
+ wait_for_blocked_clients_count 2
+
+ # After a while call xadd and let rd2 re-process the command.
+ after 200
+ r xadd mystream * field value
+ assert_equal {} [$rd2 read]
+ set end [clock milliseconds]
+
+ # Before the fix in #13004, this time would have been 1200+ (i.e. more than 1200ms),
+ # now it should be 1000, but in order to avoid timing issues, we increase the range a bit.
+ assert_range [expr $end-$start] 1000 1150
+
+ $rd1 close
+ $rd2 close
+ }
+
test {XGROUP DESTROY should unblock XREADGROUP with -NOGROUP} {
r config resetstat
r del mystream