lib/good_job/execution.rb in good_job-2.6.0 vs lib/good_job/execution.rb in good_job-2.6.1

- old
+ new

@@ -4,10 +4,11 @@ # Parent class can be configured with +GoodJob.active_record_parent_class+. # @!parse # class Execution < ActiveRecord::Base; end class Execution < Object.const_get(GoodJob.active_record_parent_class) include Lockable + include Filterable # Raised if something attempts to execute a previously completed Execution again. PreviouslyPerformedError = Class.new(StandardError) # String separating Error Class from Error Message @@ -152,27 +153,9 @@ elsif parsed[:exclude] where.not(queue_name: parsed[:exclude]).or where(queue_name: nil) elsif parsed[:include] where(queue_name: parsed[:include]) end - end) - - # Get Jobs in display order with optional keyset pagination. - # @!method display_all(after_scheduled_at: nil, after_id: nil) - # @!scope class - # @param after_scheduled_at [DateTime, String, nil] - # Display records scheduled after this time for keyset pagination - # @param after_id [Numeric, String, nil] - # Display records after this ID for keyset pagination - # @return [ActiveRecord::Relation] - scope :display_all, (lambda do |after_scheduled_at: nil, after_id: nil| - query = order(Arel.sql('COALESCE(scheduled_at, created_at) DESC, id DESC')) - if after_scheduled_at.present? && after_id.present? - query = query.where(Arel.sql('(COALESCE(scheduled_at, created_at), id) < (:after_scheduled_at, :after_id)'), after_scheduled_at: after_scheduled_at, after_id: after_id) - elsif after_scheduled_at.present? - query = query.where(Arel.sql('(COALESCE(scheduled_at, created_at)) < (:after_scheduled_at)'), after_scheduled_at: after_scheduled_at) - end - query end) # Finds the next eligible Execution, acquire an advisory lock related to it, and # executes the job. # @return [ExecutionResult, nil]