app/models/good_job/execution.rb in good_job-3.26.2 vs app/models/good_job/execution.rb in good_job-3.27.0
- old
+ new
@@ -14,10 +14,11 @@
# ActiveJob jobs without a +priority+ attribute are given this priority.
DEFAULT_PRIORITY = 0
self.table_name = 'good_jobs'
self.advisory_lockable_column = 'active_job_id'
+ self.implicit_order_column = 'created_at'
define_model_callbacks :perform
define_model_callbacks :perform_unlocked, only: :after
set_callback :perform, :around, :reset_batch_values
@@ -92,10 +93,10 @@
# Get executions that are not scheduled for a later time than now (i.e. jobs that
# are not scheduled or scheduled for earlier than the current time).
# @!method only_scheduled
# @!scope class
# @return [ActiveRecord::Relation]
- scope :only_scheduled, -> { where(arel_table['scheduled_at'].lteq(Time.current)).or(where(scheduled_at: nil)) }
+ scope :only_scheduled, -> { where(arel_table['scheduled_at'].lteq(Arel::Nodes::BindParam.new(ActiveModel::Attribute.with_cast_value("scheduled_at", Time.current, ActiveModel::Type::DateTime.new)))).or(where(scheduled_at: nil)) }
# Order executions by priority (highest priority first).
# @!method priority_ordered
# @!scope class
# @return [ActiveRecord::Relation]