stefanwille / crystal-redis

Full featured Redis client for Crystal
MIT License
381 stars 61 forks source link

difference between blpop and brpop #111

Closed sa-0001 closed 3 years ago

sa-0001 commented 3 years ago

the following code works correctly for brpop, but raises an exception for blpop:

result = redis.brpop ["test_list"], 1
if result && result.size > 0 && result[0] == "test_list"
    pp result[1]
else
    puts "empty"
end

the above example correctly outputs the expected item. however, change brpop to blpop, and the result is Unhandled exception: Empty enumerable (Enumerable::EmptyError).

looking in the source code, i see that blpop and brpop are implemented slightly differently. does this mean they need to be used differently as well, or that there is a small inconsistency in the source?

kostya commented 3 years ago

this should be fixed in 2.7.0