factorylabs-delayed_job 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/delayed_job.gemspec +1 -1
- data/lib/delayed/command.rb +10 -6
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.3
|
data/delayed_job.gemspec
CHANGED
data/lib/delayed/command.rb
CHANGED
@@ -46,19 +46,23 @@ module Delayed
|
|
46
46
|
def daemonize
|
47
47
|
worker_count.times do |worker_index|
|
48
48
|
process_name = worker_count == 1 ? "delayed_job" : "delayed_job.#{worker_index}"
|
49
|
-
FileUtils.mkdir_p "#{root_path}/tmp/pids"
|
50
|
-
Daemons.run_proc(process_name, :dir => "#{root_path}/tmp/pids", :dir_mode => :normal, :ARGV => @args) do |*args|
|
49
|
+
FileUtils.mkdir_p "#{self.root_path}/tmp/pids"
|
50
|
+
Daemons.run_proc(process_name, :dir => "#{self.root_path}/tmp/pids", :dir_mode => :normal, :ARGV => @args) do |*args|
|
51
51
|
run process_name
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def run(worker_name = nil)
|
57
|
-
Dir.chdir(root_path)
|
58
|
-
require File.join(root_path, 'config', 'environment') if ENV['RAILS_ENV']
|
59
57
|
self.instance_eval(&@configuration) if @configuration
|
58
|
+
|
59
|
+
Dir.chdir(self.root_path)
|
60
|
+
rails_environment = File.join(self.root_path, 'config', 'environment')
|
61
|
+
require rails_environment if File.exists?(rails_environment)
|
62
|
+
|
60
63
|
# Replace the default logger
|
61
|
-
logger = Logger.new(File.join(root_path, 'log', 'delayed_job.log'))
|
64
|
+
logger = Logger.new(File.join(self.root_path, 'log', 'delayed_job.log'))
|
65
|
+
logger.info "*** starting Delayed Job daemon ***"
|
62
66
|
logger.level = ActiveRecord::Base.logger.level
|
63
67
|
ActiveRecord::Base.logger = logger
|
64
68
|
ActiveRecord::Base.clear_active_connections!
|
@@ -67,7 +71,7 @@ module Delayed
|
|
67
71
|
|
68
72
|
Delayed::Worker.new(@options).start
|
69
73
|
rescue => e
|
70
|
-
logger.fatal e
|
74
|
+
logger.fatal e unless logger.nil?
|
71
75
|
STDERR.puts e.message
|
72
76
|
exit 1
|
73
77
|
end
|