2013-11-01 17:57:50 -05:00
|
|
|
require "demon/base"
|
2013-10-09 21:33:52 -05:00
|
|
|
|
|
|
|
class Demon::Sidekiq < Demon::Base
|
2013-11-01 17:57:50 -05:00
|
|
|
|
2013-10-09 21:33:52 -05:00
|
|
|
def self.prefix
|
|
|
|
"sidekiq"
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2014-04-17 00:57:17 -05:00
|
|
|
def suppress_stdout
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def suppress_stderr
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2013-10-09 21:33:52 -05:00
|
|
|
def after_fork
|
2014-04-17 00:57:17 -05:00
|
|
|
STDERR.puts "Loading Sidekiq in process id #{Process.pid}"
|
2013-10-09 21:33:52 -05:00
|
|
|
require 'sidekiq/cli'
|
2013-11-01 17:57:50 -05:00
|
|
|
cli = Sidekiq::CLI.instance
|
2014-05-13 19:21:11 -05:00
|
|
|
cli.parse(["-c", GlobalSetting.sidekiq_workers.to_s])
|
2014-04-17 00:57:17 -05:00
|
|
|
|
|
|
|
load Rails.root + "config/initializers/sidekiq.rb"
|
2013-11-01 17:57:50 -05:00
|
|
|
cli.run
|
|
|
|
rescue => e
|
|
|
|
STDERR.puts e.message
|
|
|
|
STDERR.puts e.backtrace.join("\n")
|
|
|
|
exit 1
|
2013-10-09 21:33:52 -05:00
|
|
|
end
|
2013-11-01 17:57:50 -05:00
|
|
|
|
2013-10-09 21:33:52 -05:00
|
|
|
end
|