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

SSCAN, HSCAN, ZSCAN are not handled correctly #128

Open
bnymn opened this issue Feb 1, 2017 · 2 comments
Open

SSCAN, HSCAN, ZSCAN are not handled correctly #128

bnymn opened this issue Feb 1, 2017 · 2 comments

Comments

@bnymn
Copy link

bnymn commented Feb 1, 2017

These commands are almost the same with SCAN command according to this documentation.

"hscan"            => [ :first ],
"hscan_each" => [ :first ],
..
"sscan"            => [ :first ],
"sscan_each" => [ :first ],
..
"zscan_each"       => [ :first ],
"zscore" => [ :first ],

They should configured like the following:

"scan"             => [ :scan_style, :second ],
"scan_each" => [ :scan_style, :all ],

I'm getting the following error if I use SSCAN command.

$redis.sscan(0)
ArgumentError: wrong number of arguments (given 1, expected 2..3)
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-3.3.2/lib/redis.rb:2603:in `sscan'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-namespace-1.5.2/lib/redis/namespace.rb:393:in `call_with_namespace'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redis-namespace-1.5.2/lib/redis/namespace.rb:290:in `method_missing'
	from (irb):5
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in `start'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in `start'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
	from /ssd/Projects/news2023.com/bin/rails:9:in `<top (required)>'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/commands/rails.rb:6:in `call'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/command_wrapper.rb:38:in `call'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:191:in `block in serve'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:161:in `fork'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:161:in `serve'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:131:in `block in run'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:125:in `loop'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application.rb:125:in `run'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.0/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'
@corincerami
Copy link
Member

What's needed I believe is to update the method_missing in lib/redis/namespace.rb to properly pass keyword arguments, like def method_missing(command, *args, **kwargs, &block) and then call_with_namespace(command, *args, **kwargs, &block).

@PatrickTulskie
Copy link
Contributor

Feel free to throw up a PR for this fix. I don't use those parts of Redis myself but if you have experience with them and can verify they work and include tests then that's cool with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants