mperham/girl_friday

GirlFriday.status error: LocalJumpError: no block given (yield)

Closed this issue · 5 comments

I put this in my girl_friday.rb initializer:

require 'redis'
require 'connection_pool'

$redis = ConnectionPool.new(size: 4) { Redis.connect(url: ENV["REDISTOGO_URL"]) }

SYNC_ACCOUNT_QUEUE = GirlFriday::WorkQueue.new(:sync_account, size: 2, store: GirlFriday::Store::Redis, store_config: { pool: $redis }) do |msg|
Account.sync_account_info(msg[:account_id])
end

When I tried to run GirlFriday.status I get this now:

LocalJumpError: no block given (yield)
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:56:in block in redis'
from /app/vendor/bundle/ruby/1.9.1/gems/connection_pool-0.1.0/lib/connection_pool.rb:41:inwith'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:55:in redis'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:44:insize'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/work_queue.rb:55:in status'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:43:inblock in status'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:in each'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:ininject'
from /app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:in `status'

Fredrik, this is a bug in the current release of girl_friday. It has been
fixed in master. Could you try using the current master for now? We will
release a new version of girl_friday at some point in the near future, and
it will contain this bug fix. There was a regression in
GirlFriday::Store::Redis#size after the recent refactor to use
connection_pool (just fixed today in master).

On Mon, Sep 26, 2011 at 6:12 PM, Fredrik Bjrk <
reply@reply.github.com>wrote:

I put this in my girl_friday.rb initializer:

require 'redis'
require 'connection_pool'

$redis = ConnectionPool.new(size: 4) { Redis.connect(url:
ENV["REDISTOGO_URL"]) }

SYNC_ACCOUNT_QUEUE = GirlFriday::WorkQueue.new(:sync_account, size: 2,
store: GirlFriday::Store::Redis, store_config: { pool: $redis }) do |msg|
Account.sync_account_info(msg[:account_id])
end

When I tried to run GirlFriday.status I get this now:

LocalJumpError: no block given (yield)
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:56:in
block in redis'
from
/app/vendor/bundle/ruby/1.9.1/gems/connection_pool-0.1.0/lib/connection_pool.rb:41:inwith'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:55:in
redis'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/persistence.rb:44:insize'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday/work_queue.rb:55:in
status'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:43:inblock
in status'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:in
each'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:ininject'
from
/app/vendor/bundle/ruby/1.9.1/gems/girl_friday-0.9.6/lib/girl_friday.rb:41:in
`status'

Reply to this email directly or view it on GitHub:
#37

Ryan, any idea how this bug could have gotten released? I thought we had tests for Redis storage.

No clue, it looks like it got in there with @jc00ke's release yesterday. When I was doing my code cleanup branch this morning I noticed that the #size method was broken, and fixed it. I forgot to mention it to you guys this morning when I sent the code review out. I thought we had Redis tests too, but perhaps none that exercised #size.

Added exercise for #size

Great. I think this was a result of the recent refactor to use connection_pool for the Redis storage class (that particular method wasn't using the block-based approach). Thanks for adding the test!