In addition to firing up workers on our own, we can set the configuration
option to zero or less, and have that disable internal process management.
This is useful if folks want to make arrangements on their own to manage the
workers, for example during development.
---
README.markdown | 4 ++++
config/initializers/delayed_job.rb | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/README.markdown b/README.markdown
index 4b724db..f199272 100644
--- a/README.markdown
+++ b/README.markdown
@@ -358,6 +358,10 @@ The Puppet Dashboard performs a number of tasks, such as
report import, that can
The Puppet Dashboard code will automatically spawn a manager and worker in the
background, which will run these tasks without tying up the resources of the
web server. This will share the same credentials and access as the web
front-end, so should introduce no additional security risk.
+You should set the `delayed_job_workers` configuration value to the number of
workers you want running; we recommend one per core. If this is greater than
zero we will automatically start a worker monitor in the background to perform
background tasks.
+
+This is not entirely efficient or easy to monitor, however, so you might
instead want to set that to zero and fire up the worker monitor yourself. See
`scripts/delayed_job --help` for details on firing up the worker daemon
manually.
+
Performance
-----------
diff --git a/config/initializers/delayed_job.rb
b/config/initializers/delayed_job.rb
index 737f7c7..2346782 100644
--- a/config/initializers/delayed_job.rb
+++ b/config/initializers/delayed_job.rb
@@ -5,6 +5,8 @@ Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.max_attempts = 3
def start_delayed_job
+ return if Rails.env == 'test'
+ return if SETTINGS.delayed_job_workers <= 0
Thread.new do
`#{Rails.root}/script/delayed_job --pid-dir=#{DELAYED_JOB_PID_PATH} -p
dashboard -n #{SETTINGS.delayed_job_workers || 2} -m start`
end
@@ -20,8 +22,6 @@ def process_is_dead?
end
end
-unless Rails.env == 'test'
- if !File.exist?(DELAYED_JOB_PID_PATH + 'delayed_job.pid') && process_is_dead?
- start_delayed_job
- end
+if !File.exist?(DELAYED_JOB_PID_PATH + 'delayed_job.pid') && process_is_dead?
+ start_delayed_job
end
--
1.7.5.4
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.