lib/negroku/templates/tasks/eye/_delayed_job.erb in negroku-2.0.0.pre7 vs lib/negroku/templates/tasks/eye/_delayed_job.erb in negroku-2.0.0
- old
+ new
@@ -1,28 +1,21 @@
-cwd = File.expand_path(File.join(File.dirname(__FILE__), %w[ ../ ../ ]))
+ group 'delayed-jobs' do
+ chain grace: 10.seconds
-config_path = File.join(cwd, %w{ config dj.yml } )
+ start_timeout 20.seconds
+ stop_timeout 20.seconds
+ restart_timeout 20.seconds
-workers_count = if File.exists?(config_path)
- YAML.load_file(config_path).try(:[], :workers) || 5
-else
- 5
-end
+ workers_count = '<%= fetch(:delayed_job_workers || 1) %>'.to_i
-Eye.application 'delayed_job' do
- working_dir cwd
- stop_on_delete true
+ (0 ... workers_count.to_i).each do |i|
- group 'dj' do
- chain grace: 5.seconds
+ process "worker-#{i}" do
+ pid_file "tmp/pids/delayed_job.#{i}.pid"
+ start_command "<%= options[:start_command] %>"
+ stop_command "<%= options[:stop_command] %>"
+ end
- (1 .. workers_count).each do |i|
- process "dj-#{i}" do
- pid_file "tmp/pids/delayed_job.#{i}.pid"
- start_command "rake jobs:work"
- daemonize true
- stop_signals [:INT, 30.seconds, :TERM, 10.seconds, :KILL]
- stdall "log/dj-#{i}.log"
- end
end
+
end
-end
+