Skip to content
Browse files

reimplement ono@6790e8c using separate task

  • Loading branch information...
1 parent cea58cc commit 6066e4a88045cd76eaef438fd777f742061a8fb1 @yaauie yaauie committed with steveklabnik
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/resque/tasks.rb
View
12 lib/resque/tasks.rb
@@ -5,7 +5,7 @@
task :setup
desc "Start a Resque worker"
- task :work => [ :preload, :setup ] do
+ task :work => [ :pidfile, :preload, :setup ] do
require 'resque'
queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split(',')
@@ -26,10 +26,6 @@
Process.daemon(true)
end
- if ENV['PIDFILE']
- File.open(ENV['PIDFILE'], 'w') { |f| f << worker.pid }
- end
-
worker.log "Starting worker #{worker}"
worker.work(ENV['INTERVAL'] || 5) # interval, will block
@@ -59,4 +55,10 @@
Rails::Initializer.run :load_application_classes
end
end
+
+ task :pidfile do
+ if ENV['PIDFILE']
+ File.open(ENV['PIDFILE'], 'w') { |f| f << Process.pid }
+ end
+ end
end

0 comments on commit 6066e4a

Please sign in to comment.
Something went wrong with that request. Please try again.