contribsys / faktory_worker_ruby

Faktory worker for Ruby
GNU Lesser General Public License v3.0
214 stars 31 forks source link

Fallback to the main Faktory reloader if the manager doesn't supply one #14

Closed jagthedrummer closed 6 years ago

jagthedrummer commented 6 years ago

I'm using the Launcher to start a worker, and in the log for the worker I'm seeing this error:

NoMethodError: undefined method `call' for nil:NilClass
faktory_worker_ruby/lib/faktory/processor.rb:132:in `block (2 levels) in dispatch'

This change allows fallback to the main Faktory reloader if the manager doesn't supply one. (And this fixes the problem I'm having.)

The code I'm using to start a worker is:

require "faktory/launcher"
faktory = Faktory::Launcher.new(queues: ["blarf"],
                                 environment: "test",
                                 concurrency: 1,
                                 timeout: 1)
faktory.run

Maybe instead of falling back like this, the proper solution is to pass some kind of reloader argument to the Lanucher? I'm not sure...

mperham commented 6 years ago

Seems like the mgr options should be merged with the default options?

jagthedrummer commented 6 years ago

Oh yeah, that sounds like it makes sense. Should that happen within this initialize method? Or in the manager itself somewhere?

mperham commented 6 years ago

I think Launcher should do it. That’s the public API people (like you) will use.

On Mar 17, 2018, at 14:47, Jeremy Green notifications@github.com wrote:

Oh yeah, that sounds like it makes sense. Should that happen within this initialize method? Or in the manager itself somewhere?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

jagthedrummer commented 6 years ago

Ok, just pushed the change to have the Launcher merge the options before passing them to the Manager.