allow configuring some dj worker options in the yml
It'd be nice to have a UI for this at some point Change-Id: I74029e709a69705eba7e16f50a7fb6d4030259d1 Reviewed-on: https://gerrit.instructure.com/3138 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
parent
3f1499ebec
commit
b8dabef28c
|
@ -6,6 +6,7 @@ production:
|
|||
- queue: canvas_queue
|
||||
workers: 4
|
||||
- periodic: config/periodic_jobs.rb
|
||||
max_run_time: 28800
|
||||
|
||||
default:
|
||||
workers:
|
||||
|
|
|
@ -46,6 +46,9 @@ module Delayed
|
|||
"Invalid config file #{config_filename}"
|
||||
end
|
||||
logger.auto_flushing = true if logger.respond_to?(:auto_flushing)
|
||||
Worker::Settings.each do |setting|
|
||||
Worker.send("#{setting}=", @config[setting.to_s]) if @config.key?(setting.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
def environment
|
||||
|
|
|
@ -35,7 +35,9 @@ module Delayed
|
|||
end
|
||||
|
||||
class Worker < WorkerBase
|
||||
cattr_accessor :min_priority, :max_priority, :max_attempts, :max_run_time, :sleep_delay, :queue, :cant_fork
|
||||
Settings = [ :max_attempts, :max_run_time, :sleep_delay, ]
|
||||
cattr_accessor *Settings
|
||||
cattr_accessor :min_priority, :max_priority, :queue, :cant_fork
|
||||
self.sleep_delay = 5
|
||||
self.max_attempts = 25
|
||||
self.max_run_time = 4.hours
|
||||
|
|
Loading…
Reference in New Issue