Skip to content

Commit c1b941e

Browse files
committed
fix
1 parent 2b09e8c commit c1b941e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/commands.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ resorting to the use of `Dict`, which cannot be used in the case where all entri
164164
# number), represented as string.
165165
@redisfunction "zscore" Union{AbstractString, Nothing} key member
166166
@redisfunction "zscan" Set{AbstractString} key cursor::Integer options...
167-
# bzpopmin returns [key, data, score]
167+
# bzpopmin returns [key, data, score] or nothing if timeout is reached
168168
@redisfunction "bzpopmin" Union{Array{AbstractString, 1}, Nothing} keys timeout
169169

170170
function _build_store_internal(destination, numkeys, keys, weights, aggregate, command)

test/redis_tests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@ function redis_tests(conn = RedisConnection())
325325
vals2 = ["a", "b", "c", "d"]
326326
@test zinterstore(conn, testkey3, 2, [testkey, testkey2]) == 4
327327
del(conn, testkey, testkey2, testkey3)
328+
329+
# test using bzpopmin
330+
vals2 = ["a", "b", "c", "d"]
331+
zadd(conn, testkey, zip([4, 2, 1, 3], vals2)...)
332+
@test bzpopmin(conn, testkey, 0) == [testkey, "c", "1"]
333+
@test bzpopmin(conn, testkey, 0) == [testkey, "b", "2"]
334+
@test bzpopmin(conn, testkey, 0) == [testkey, "d", "3"]
335+
@test bzpopmin(conn, testkey, 0) == [testkey, "a", "4"]
336+
@test bzpopmin(conn, testkey, 0.1) == nothing
337+
del(conn, testkey)
328338
end
329339

330340
@testset "Scan" begin

0 commit comments

Comments
 (0)