Skip to content
Browse files

Merge branch 'master' of https://github.com/bluetools/delayed_job

* 'master' of https://github.com/bluetools/delayed_job:
  Added 'delayed_job_server_role' Capistrano variable to allow delayed_job to run on its own worker server.
  • Loading branch information...
2 parents 8ea6cb4 + 146fe98 commit d4c1a9333d03eae674bfd1271123cfb1f21aee46 @bkeepers bkeepers committed
Showing with 18 additions and 3 deletions.
  1. +18 −3 lib/delayed/recipes.rb
View
21 lib/delayed/recipes.rb
@@ -6,6 +6,17 @@
# after "deploy:stop", "delayed_job:stop"
# after "deploy:start", "delayed_job:start"
# after "deploy:restart", "delayed_job:restart"
+#
+# If you want to use command line options, for example to start multiple workers,
+# define a Capistrano variable delayed_job_args:
+#
+# set :delayed_jobs_args, "-n 2"
+#
+# If you've got delayed_job workers running on a servers, you can also specify
+# which servers have delayed_job running and should be restarted after deploy.
+#
+# set :delayed_job_server_role, :worker
+#
Capistrano::Configuration.instance.load do
namespace :delayed_job do
@@ -17,18 +28,22 @@ def args
fetch(:delayed_job_args, "")
end
+ def roles
+ fetch(:delayed_job_server_role, :app)
+ end
+
desc "Stop the delayed_job process"
- task :stop, :roles => :app do
+ task :stop, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job stop"
end
desc "Start the delayed_job process"
- task :start, :roles => :app do
+ task :start, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job start #{args}"
end
desc "Restart the delayed_job process"
- task :restart, :roles => :app do
+ task :restart, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job restart #{args}"
end
end

0 comments on commit d4c1a93

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