app/models/good_job/execution.rb in good_job-3.17.0 vs app/models/good_job/execution.rb in good_job-3.17.1
- old
+ new
@@ -74,11 +74,11 @@
GoodJob::DiscreteExecution.where(active_job_id: active_job_id).delete_all if discrete? # TODO: move into association `dependent: :delete_all` after v4
self.class.active_job_id(active_job_id).delete_all
}, if: -> { @_destroy_job }
# Get executions with given ActiveJob ID
- # @!method active_job_id
+ # @!method active_job_id(active_job_id)
# @!scope class
# @param active_job_id [String]
# ActiveJob ID
# @return [ActiveRecord::Relation]
scope :active_job_id, ->(active_job_id) { where(active_job_id: active_job_id) }
@@ -113,11 +113,11 @@
# @!scope class
# @return [ActiveRecord:Relation]
scope :creation_ordered, -> { order(created_at: :asc) }
# Order executions for de-queueing
- # @!method dequeueing_ordered
+ # @!method dequeueing_ordered(parsed_queues)
# @!scope class
# @param parsed_queues [Hash]
# optional output of .queue_parser, parsed queues, will be used for
# ordered queues.
# @return [ActiveRecord::Relation]
@@ -128,11 +128,11 @@
relation
end)
# Order executions in order of queues in array param
- # @!method queue_ordered
+ # @!method queue_ordered(queues)
# @!scope class
# @param queues [Array<string] ordered names of queues
# @return [ActiveRecord::Relation]
scope :queue_ordered, (lambda do |queues|
clauses = queues.map.with_index do |queue_name, index|
@@ -298,12 +298,9 @@
# The job to enqueue.
# @param scheduled_at [Float]
# Epoch timestamp when the job should be executed, if blank will delegate to the ActiveJob instance
# @param create_with_advisory_lock [Boolean]
# Whether to establish a lock on the {Execution} record after it is created.
- # @param persist_immediately [Boolean]
- # Whether to save the record immediately or just initialize it with values. When bulk-inserting
- # jobs the caller takes care of the persistence and sets this parameter to `false`
# @return [Execution]
# The new {Execution} instance representing the queued ActiveJob job.
def self.enqueue(active_job, scheduled_at: nil, create_with_advisory_lock: false)
ActiveSupport::Notifications.instrument("enqueue_job.good_job", { active_job: active_job, scheduled_at: scheduled_at, create_with_advisory_lock: create_with_advisory_lock }) do |instrument_payload|
current_execution = CurrentThread.execution