Skip to content

Commit

Permalink
xread with block in scripts can get reply from non empty streams
Browse files Browse the repository at this point in the history
  • Loading branch information
soloestoy committed Oct 11, 2023
1 parent 2b36640 commit c30adb7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/unit/scripting.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ start_server {tags {"scripting"}} {

test {EVAL - Scripts do not block on XREAD with BLOCK option -- non empty stream} {
r XADD s * a 1
run_script {return redis.pcall('xread','BLOCK',0,'STREAMS','s','$')} 0
} {}
set res [run_script {return redis.pcall('xread','BLOCK',0,'STREAMS','s','$')} 0]
assert {$res eq {}}

set res [run_script {return redis.pcall('xread','BLOCK',0,'STREAMS','s','0-0')} 0]
assert {[lrange [lindex $res 0 1 0 1] 0 1] eq {a 1}}
}

test {EVAL - Scripts do not block on XREADGROUP with BLOCK option -- non empty stream} {
r XADD s * b 2
Expand Down

0 comments on commit c30adb7

Please sign in to comment.