delayed_job :run_at is not working. all jobs set to run at current time

Posted by jtwg on Stack Overflow See other posts from Stack Overflow or by jtwg
Published on 2012-03-24T17:26:37Z Indexed on 2012/03/24 17:29 UTC
Read the original article Hit count: 299

I have installed the collectiveidea fork for delayed_job at

git://github.com/collectiveidea/delayed_job.git

but cannot get it to accept :run_at

from my gemfile

gem 'rails', '3.2.2'
gem 'delayed_job_active_record'

when I try it in the console

1.9.2-p318 :005 > Time.now
=> 2012-03-24 10:20:34 -0700 
1.9.2-p318 :006 > User.delay.new :run_at => 5.days.from_now
 SQL (0.1ms)  BEGIN
SQL (1.6ms)  INSERT INTO `delayed_jobs` (`attempts`, `created_at`, `failed_at`, `handler`, `last_error`, `locked_at`, `locked_by`, `priority`, `run_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["attempts", 0], ["created_at", Sat, 24 Mar 2012 17:20:36 UTC +00:00], ["failed_at", nil], ["handler", "--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/class 'User'\nmethod_name: :new\nargs:\n- :run_at: 2012-03-29 17:20:36.876374000Z\n"], ["last_error", nil], ["locked_at", nil], ["locked_by", nil], ["priority", 0], ["run_at", Sat, 24 Mar 2012 17:20:36 UTC +00:00], ["updated_at", Sat, 24 Mar 2012 17:20:36 UTC +00:00]]
 (2.7ms)  COMMIT
=> #<Delayed::Backend::ActiveRecord::Job id: 17, priority: 0, attempts: 0, handler: "--- !ruby/object:Delayed::PerformableMethod\nobject:...", last_error: nil, run_at: "2012-03-24 17:20:36", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2012-03-24 17:20:36", updated_at: "2012-03-24 17:20:36"> 

I see there is some UTC offset in the runtime, but based on Time.now, I can tell run_at is not going forward by 5 days.

"run_at", Sat, 24 Mar 2012 17:20:36 UTC +00:00

Any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails-3

Related posts about delayed-job