Delayed Job just not working
Delayed::Job.enqueue
will put a record in the delayed job table, but you need to run a seperate process to execute the job code (perform method)
typically in development this would be bundle exec rake jobs:work
(NOTE: you must restart this rake task anytime you make code changes, it will not auto load changes)
- see https://github.com/collectiveidea/delayed_job#running-jobs
I usually put the following into my delayed configuration while in development - this never puts a record in the delayed job table and runs all background code synchronously (in development) and by default rails will reload changes to your code
Delayed::Worker.delay_jobs = !(Rails.env.test? || Rails.env.development?)
- https://github.com/collectiveidea/delayed_job#gory-details (see config/initializers/delayed_job_config.rb example section)
Delayed_job not working in Ruby on Rails app
You need to start the delayed_job worker to perform delayed tasks...in your terminal from app root directory do
rake jobs:work
delayed job not performing after being enqued, rails
the above log says that job is enqueued (which proves my delayed job worker is working fine)
Nope. This means that the "enqueuer" is working fine. Says nothing about the worker.
It should be run as a separate process.
bundle exec rake jobs:work
Rails delayed jobs stops on staging
Create a shell script file in the root directory and place this code .
Then give permissions to the file
ps_out=`ps -ef | grep delayed | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
echo "Running"
else
/path-to-your-project/delayed_job start
fi
Now add this in crontab
crontab -e
Why won't delayed job process enqueued job?
After fiddling around in the gem I narrowed the problem down to delayed_job not looking for locked records correctly. It was including milliseconds in the filter for locked_at. mySql stores datetimes without the milliseconds so nothing was being picked up. After a bit more research in the gem in github delayed_job_active_record
(I thought the problem was me!) I found this fix. This resolves my issue.
The reason it was happening for me was I was referencing the latest gem 4.0.2 before this fix! Just my luck.
So if you are using 4.0.2 ... just upgrade and it should disappear.
Related Topics
M Hartl's Ruby on Rails Tutorial Chapter 5 Custom Title on Home Page
Will Uuid as Primary Key in Postgresql Give Bad Index Performance
Generating Unique, Hard-To-Guess "Coupon" Codes
Restoring Rails 3's Bundle Install Path... It's Now Install in My Root
Ruby Classes Within Classes (Or Modules Within Modules)
Rails Model Has_Many , Belongs_To Relations
Why Does Ruby "Script/Generate" Return "No Such File or Directory"
Is Ruby on Rails (Or at Least the Community) Dying
How to Use Ruby's Readlines.Grep for Utf-16 Files
Remove Substring from the String
How to Run Shell Commands on Server in Capistrano V3
How to Convert a JSON Formatted Key Value Pair to Ruby Hash with Symbol as Key
Rails 3/Ruby: Activerecord Find Method in Condition Array to Parameters Single Quote Issue
Jekyll on Windows: Pygments Not Working