I am using following gems:
gem 'daemons', "=1.0.10"
gem 'delayed_job_active_record'
and following command to delay the method:
after_create :perform_analysis handle_asynchronously :perform_analysis, :run_at => Proc.new { 1.minutes.from_now }
script/delayed_job:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
So, I start the application with usual rails s (in tmp/pids appears a file server.pid). Upload some stuff, so the create method is invoked. Some data is inserted into delayed_jobs table. I close stop running the server(in tmp/pids exists nothing!).
Then I write into a command line:
RAILS_ENV=production script/delayed_job start
Response: in tmp/pids appeard delayed_job.pid and terminal shows me nothing, so I run:
kik@kik-VirtualBox:~/Desktop/tors15.01$ RAILS_ENV=production script/delayed_job status
pid-file for killed process 8695 found (/home/kik/Desktop/tors15.01/tmp/pids/delayed_job.pid), deleting.
delayed_job: no instances running
and again trying my luck:
kik@kik-VirtualBox:~/Desktop/tors15.01$ RAILS_ENV=production script/delayed_job start
kik@kik-VirtualBox:~/Desktop/tors15.01$ RAILS_ENV=production script/delayed_job run
pid-file for killed process 8718 found (/home/kik/Desktop/tors15.01/tmp/pids/delayed_job.pid), deleting.
SQLite3::SQLException: no such table: delayed_jobs: UPDATE "delayed_jobs" SET locked_by = null, locked_at = null WHERE (locked_by = 'delayed_job host:kik-VirtualBox pid:8724')
When I tun rake jobs:work it is working
What is the reason for this ot where do I do a mistake? Thanks in advance
Are you sure about setting the rails environment to production?
script/delayed_job start
or
RAILS_ENV=development script/delayed_job start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With