Skip to content

Commit

Permalink
Fixed Delayed::Command daemonize to create tmp/pids directory (if it …
Browse files Browse the repository at this point in the history
…doesn't exist) before launching worker processes.
  • Loading branch information
Denis Ahearn authored and bkeepers committed Apr 9, 2010
1 parent be12e60 commit 8ec8ca4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/delayed/command.rb
Expand Up @@ -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
Expand Down

0 comments on commit 8ec8ca4

Please sign in to comment.