-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Home
Q: Hello, tobi, I tried this plugin but I got 2 failing built-in specs. The “delayed_job / lib / delayed / job.rb” line 94 is “(`locked_at` IS NULL OR `locked_at` < #{quote_value(now + max_run_time)})”. Should it be “(… < #{quote_value(now – max_run_time)})”?
A: I got that same error. I think it’s a problem with postgres compatibility. I forked and fixed the problem, although I’m not sure if it’s the right way to do it.
Q: How to a configure the plugin to save failed jobs?
A: Here’s how I configured the plugin. I also wanted to change the number of max attempts, etc:
# config/initializers/delayed_job_config.rb
Delayed::Job.destroy_failed_jobs = false
silence_warnings do
Delayed::Job.const_set("MAX_ATTEMPTS", 3)
Delayed::Job.const_set("MAX_RUN_TIME", 5.minutes)
end
Q: I’m having trouble keeping the job running going when jobs fail. Isn’t there a way to store the error message and move on?
A: My errors are long, so I had to change the last_error column from string to text:
class ChangeLastErrorInDelayedJobsToText < ActiveRecord::Migration
def self.up
change_column :delayed_jobs, :last_error, :text
end
def self.down
change_column :delayed_jobs, :last_error, :string
end
end