Skip to content

Instantly share code, notes, and snippets.

@tungd
Last active December 18, 2015 22:49
Show Gist options
  • Save tungd/5856811 to your computer and use it in GitHub Desktop.
Save tungd/5856811 to your computer and use it in GitHub Desktop.
delayed_job Rails 4 upgrade note

Code change

There was a proposal for an common queuing API for Rails, but was removed as of Rails 4 RC1 and will not be shipped with Rails 4 (FYI https://github.com/rails/rails/commit/f9da785d0b1b22317cfca25c15fb555e9016accb); so there is no change in term of code to user delayed_job in Rails 4.

Deployment change

However, in Rails 4, the script directory was renamed to bin (to update run rake rails:update:bin) so the command to run DelayedJob workers now is:

# Old
# RAILS_ENV=production script/delayed_job start
# RAILS_ENV=production script/delayed_job stop

# New
RAILS_ENV=production bin/delayed_job start
RAILS_ENV=production bin/delayed_job stop

If running from rake, the command is not changed:

QUEUE=tracking rake jobs:work
QUEUES=mailers,tasks rake jobs:work

Capistrano config for delayed_job in deploy.rb should be changed:

require "delayed/recipes"

# set :delayed_job_command, "bundle exec ruby script/delayed_job"
set :delayed_job_command, "bundle exec ruby bin/delayed_job"

after "deploy:stop", "delayed_job:stop"
after "deploy:start", "delayed_job:start"
after "deploy:restart", "delayed_job:restart"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment