quirkey/resque-status

Bad behavior when Resque.inline is true (Resque hooks aren't run, option access is different)

Closed this issue · 6 comments

I think resque-status should revert pull request #69.

This kind of support for Resque.inline is bad for two reasons:

  1. You lose all the Resque hooks because you're just calling #perform directly instead of letting Resque run
  2. You can have different option behavior. When you call MyJob.create(:foo => "bar"), Redis serializes those options as {"foo" => "bar"}. In the job in production, options["foo"] returns the right value whereas options[:foo] returns nil. However, by passing options directly when Resque.inline is true, options[:foo] is the way to get your value.

i ran into issue #2 above so i just added active_support:

require 'active_support/core_ext/hash/indifferent_access'

and changed the get method. now in the job's perform action, either options[:foo] or options['foo'] returns the value.

That's a workaround, but (1) is still a problem. Resque hooks ought to run or your workers will behave differently in development than in staging/production, which is a recipe for disaster (and testing nightmares).

@quirkey what are your thoughts on this?

Thanks.

@jonhyman - sorry it took a minute. Had to read through all the inline code in Resque itself

No problem, glad you got a chance to look at it. I had pegged our code at 0.3.3 due to the issues in testing around the Resque hooks, so I'm happy to get to upgrade to 4.x now. :)