Permalink
Browse files

Fixed Delayed::Command daemonize to create tmp/pids directory (if it …

…doesn't exist) before launching worker processes.
  • Loading branch information...
Denis Ahearn authored and bkeepers committed Apr 7, 2010
1 parent be12e60 commit 8ec8ca414ccf94f662ff32d5ba071f8c3319cc71
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/delayed/command.rb
View
@@ -42,9 +42,12 @@ def daemonize
@files_to_reopen << file unless file.closed?
end
+ dir = "#{RAILS_ROOT}/tmp/pids"
+ Dir.mkdir(dir) unless File.exists?(dir)
+
worker_count.times do |worker_index|
process_name = worker_count == 1 ? "delayed_job" : "delayed_job.#{worker_index}"
- Daemons.run_proc(process_name, :dir => "#{RAILS_ROOT}/tmp/pids", :dir_mode => :normal, :ARGV => @args) do |*args|
+ Daemons.run_proc(process_name, :dir => dir, :dir_mode => :normal, :ARGV => @args) do |*args|
run process_name
end
end

0 comments on commit 8ec8ca4

Please sign in to comment.