Skip to content

Instantly share code, notes, and snippets.

@CvX
Created September 9, 2011 15:59
Show Gist options
  • Save CvX/1206589 to your computer and use it in GitHub Desktop.
Save CvX/1206589 to your computer and use it in GitHub Desktop.
background:
RAILS >= 3.0
SQLITE3 >= 3.7.5
>> Delayed::Job.all
Delayed::Backend::ActiveRecord::Job Load (0.3ms) SELECT "delayed_jobs".* FROM "delayed_jobs"
=> [#<Delayed::Backend::ActiveRecord::Job id: 1, priority: 0, attempts: 0,
handler: "--- !ruby/ActiveRecord:Build \nattributes: \n id: 1\n...", last_error: nil,
run_at: "2011-09-09 15:00:20", locked_at: nil, failed_at: nil, locked_by: nil,
created_at: "2011-09-09 15:00:20", updated_at: "2011-09-09 15:00:20">]
>> Delayed::Worker.new.work_off
SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE
((run_at <= '2011-09-09 15:20:45.037467' AND (locked_at IS NULL OR locked_at < '2011-09-09 11:20:45.037488')
OR locked_by = 'host:CvX-MBP.local pid:39528') AND failed_at IS NULL)
ORDER BY priority ASC, run_at ASC LIMIT 5
=> [0, 0]
(0 done, 0 failed)
THE PROBLEM?
SELECT * FROM delayed_jobs WHERE run_at <= '2011-09-09 15:20:45.037467'
returns no records
WHAT DOES?
THIS:
SELECT * FROM delayed_jobs WHERE DATETIME(run_at) <= '2011-09-09 15:20:45.037467'
WHO IS TO BLAME?
RAILS?
SQLITE3?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment