BUGFIX: Sidekiq could be initialized incorrectly in some cases

Symptom, no jobs run
This commit is contained in:
Sam 2014-06-03 17:17:10 +10:00
parent 86c0d890d6
commit 95159fb82a
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,11 @@ class Demon::Sidekiq < Demon::Base
def after_fork
STDERR.puts "Loading Sidekiq in process id #{Process.pid}"
require 'sidekiq/cli'
# CLI will close the logger, if we have one set we can be in big
# trouble, if STDOUT is closed in our process all sort of weird
# will ensue, resetting the logger ensures it will reinit correctly
# parent process is in charge of the file anyway.
Sidekiq::Logging.logger = nil
cli = Sidekiq::CLI.instance
cli.parse(["-c", GlobalSetting.sidekiq_workers.to_s])