Methods
- A
- C
- D
- F
- L
- N
- R
- S
- U
Included Modules
- Delayed::Backend::Base
Attributes
| [RW] | attempts | |
| [RW] | failed_at | |
| [RW] | handler | |
| [RW] | id | |
| [RW] | last_error | |
| [RW] | locked_at | |
| [RW] | locked_by | |
| [RW] | priority | |
| [RW] | queue | |
| [RW] | run_at |
Class Public methods
all()
Link
clear_locks!(worker_name)
Link
count()
Link
create(attrs = {})
Link
create!(*args)
Link
db_time_now()
Link
delete_all()
Link
find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
Link
Find a few candidate jobs to run (in case some immediately get locked by others).
# File activejob/test/support/delayed_job/delayed/backend/test.rb, line 56 def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time) jobs = all.select do |j| j.run_at <= db_time_now && (j.locked_at.nil? || j.locked_at < db_time_now - max_run_time || j.locked_by == worker_name) && !j.failed? end jobs = jobs.select{|j| Worker.queues.include?(j.queue)} if Worker.queues.any? jobs = jobs.select{|j| j.priority >= Worker.min_priority} if Worker.min_priority jobs = jobs.select{|j| j.priority <= Worker.max_priority} if Worker.max_priority jobs.sort_by{|j| [j.priority, j.run_at]}[0..limit-1] end
new(hash = {})
Link
Instance Public methods
destroy()
Link
lock_exclusively!(max_run_time, worker)
Link
Lock this job for this worker. Returns true if we have the lock, false otherwise.
# File activejob/test/support/delayed_job/delayed/backend/test.rb, line 71 def lock_exclusively!(max_run_time, worker) now = self.class.db_time_now if locked_by != worker # We don't own this job so we will update the locked_by name and the locked_at self.locked_at = now self.locked_by = worker end return true end
reload()
Link
save()
Link
save!()
Link