From b7089ef746a6be6639828327dbf164454c8b2e5a Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Fri, 22 Feb 2013 12:40:19 -0800 Subject: [PATCH] Delay launcher until after daemonization --- lib/sidekiq/cli.rb | 4 +++- lib/sidekiq/launcher.rb | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index c963691d..98a0df4d 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -49,7 +49,6 @@ require 'erb' require 'sidekiq' require 'sidekiq/util' -require 'sidekiq/launcher' module Sidekiq class CLI @@ -90,6 +89,7 @@ module Sidekiq logger.info 'Starting processing, hit Ctrl-C to stop' end + require 'sidekiq/launcher' @launcher = Sidekiq::Launcher.new(options) launcher.procline(options[:tag] ? "#{options[:tag]} " : '') @@ -121,6 +121,8 @@ module Sidekiq private def load_celluloid + raise "Celluloid cannot be required until here, or it will break Sidekiq's daemonization" if defined?(::Celluloid) + # Celluloid can't be loaded until after we've daemonized # because it spins up threads and creates locks which get # into a very bad state if forked. diff --git a/lib/sidekiq/launcher.rb b/lib/sidekiq/launcher.rb index d152994b..ce2cad5e 100644 --- a/lib/sidekiq/launcher.rb +++ b/lib/sidekiq/launcher.rb @@ -1,4 +1,3 @@ - require 'sidekiq/util' require 'sidekiq/manager' require 'sidekiq/scheduled'