mperham/connection_pool — Issue #4: Redis error when using redis#pipelined
Author: shilov
Created: 2012-02-08 04:25:23+00:00
State: open

This issue might be related to [this one](https://github.com/mperham/girl_friday/issues/37) posted a few months ago.

The error occurs when using Redis#pipelined with the redis object instantiated with connection pooling.

Sample code:

require 'redis'
require 'connection_pool'

$r = ConnectionPool.new(size: 3){ Redis.new(path: '/tmp/redis.sock') }

$r.set 'key', 'value'
puts $r.get 'value' # prints "value"

# Throws an error:

$r.pipelined {
$r.get 'value'
}

The pipelined block will throw the following error:

`block in pipelined': no block given (yield) (LocalJumpError)

Here's the full error stack:

/Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:1045:in `block in pipelined': no block given (yield) (LocalJumpError)
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:68:in `block in synchronize'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:62:in `call'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:62:in `block (2 levels) in initialize'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:62:in `block in initialize'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:68:in `call'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:68:in `synchronize'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bundler/gems/redis-rb-e9e17d65b9c5/lib/redis.rb:1042:in `pipelined'
from /Users/shilov/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/connection_pool-0.1.0/lib/connection_pool.rb:48:in `method_missing'
from pooling.rb:9:in `

'