Skip to content

Commit

Permalink
Forked to add commit for exclude queue functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
rhartanto committed Aug 14, 2021
1 parent d65b0f9 commit c9bfcd5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/delayed/backend/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ class Job < ::ActiveRecord::Base
scope :by_priority, lambda { order("priority ASC, run_at ASC") }
scope :min_priority, lambda { where("priority >= ?", Worker.min_priority) if Worker.min_priority }
scope :max_priority, lambda { where("priority <= ?", Worker.max_priority) if Worker.max_priority }
scope :for_queues, lambda { |queues = Worker.queues| where(queue: queues) if Array(queues).any? }
scope :for_queues, lambda { |queues = Worker.queues|
if Array(queues).any?
if Worker.try(:exclude_specified_queues)
queue_column = arel_table[:queue]
where(queue_column.not_in(queues).or(queue_column.eq nil))
else
where(queue: queues)
end
end
}

before_save :set_default_run_at

Expand Down

0 comments on commit c9bfcd5

Please # to comment.