Improved error handling.

This commit is contained in:
Martin Edenhofer 2014-02-03 19:27:27 +01:00
parent 6569fe4eaa
commit b4be5da97c

View file

@ -14,9 +14,9 @@ daemon_options = {
:backtrace => true :backtrace => true
} }
worker_count = 2 runner_count = 2
(1..worker_count).each {|count| (1..runner_count).each {|count|
name = 'scheduler_runner' + count.to_s name = 'scheduler_runner' + count.to_s
Daemons.run_proc(name, daemon_options) do Daemons.run_proc(name, daemon_options) do
if ARGV.include?('--') if ARGV.include?('--')
@ -33,6 +33,27 @@ worker_count = 2
require File.join(dir, "config", "environment") require File.join(dir, "config", "environment")
require 'scheduler' require 'scheduler'
Scheduler.run(count, worker_count) Scheduler.run(count, runner_count)
end end
} }
name = 'scheduler_worker'
Daemons.run_proc(name, daemon_options) do
if ARGV.include?('--')
ARGV.slice! 0..ARGV.index('--')
else
ARGV.clear
end
Dir.chdir dir
RAILS_ENV = ARGV.first || ENV['RAILS_ENV'] || 'development'
$stdout.reopen( dir + "/log/" + name + "_out.log", "w")
$stderr.reopen( dir + "/log/" + name + "_err.log", "w")
require File.join(dir, "config", "environment")
require 'scheduler'
Scheduler.worker
end