Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make brpoplpush work with the default 0 timeout or empty timeout options #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/redis/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Namespace
"bitop" => [ :exclude_first ],
"blpop" => [ :exclude_last, :first ],
"brpop" => [ :exclude_last, :first ],
"brpoplpush" => [ :exclude_last ],
"brpoplpush" => [ :first_two ],
"debug" => [ :exclude_first ],
"decr" => [ :first ],
"decrby" => [ :first ],
Expand Down Expand Up @@ -367,6 +367,9 @@ def call_with_namespace(command, *args, &block)
case before
when :first
args[0] = add_namespace(args[0]) if args[0]
when :first_two
args[0] = add_namespace(args[0]) if args[0]
args[1] = add_namespace(args[1]) if args[1]
when :all
args = add_namespace(args)
when :exclude_first
Expand Down
7 changes: 7 additions & 0 deletions spec/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
@namespaced.lrange('bar',0,-1).should eq(['bar'])
end

it 'should be able to use a namespace with brpoplpush with default timeout' do
@namespaced.lpush('foo','bar')
@namespaced.brpoplpush('foo','bar').should eq('bar')
@namespaced.lrange('foo',0,-1).should eq([])
@namespaced.lrange('bar',0,-1).should eq(['bar'])
end

it 'should be able to use a namespace with getbit' do
@namespaced.set('foo','bar')
@namespaced.getbit('foo',1).should eq(1)
Expand Down