Skip to content

Commit

Permalink
Merge branch 'delayed_job_daemon' into guns
Browse files Browse the repository at this point in the history
  • Loading branch information
guns committed Sep 17, 2010
2 parents 706aa8b + 9b8bf90 commit c7bc0e5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/delayed/daemon_tasks.rb
Expand Up @@ -136,16 +136,14 @@
# reap dead children before the SIGCLD handler does
#
# poll passenger restart file and restart on update
years_ago = lambda { |n| Time.now - 60 * 60 * 24 * 365 * n }
mtime = lambda do |file|
File.exists?(file) ? File.mtime(file) : years_ago.call(2)
end
restart_file = "#{rails_root}/tmp/restart.txt"
last_modified = mtime.call restart_file
last_modified = File.mtime restart_file if File.exists? restart_file
loop do
if (check = mtime.call restart_file) > last_modified
last_modified = check
Process.kill :HUP, $$
if File.exists? restart_file
if (check = File.mtime restart_file) > last_modified
last_modified = check
Process.kill :HUP, $$
end
end
sleep 5
end
Expand Down

0 comments on commit c7bc0e5

Please sign in to comment.