Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/active_job/queue_adapters/solid_queue_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ module QueueAdapters
#
# Rails.application.config.active_job.queue_adapter = :solid_queue
class SolidQueueAdapter < (Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR == 1 ? Object : AbstractAdapter)
class_attribute :stopping, default: false, instance_writer: false
class_attribute :stopping, default: false, instance_writer: false, instance_predicate: false
SolidQueue.on_worker_stop { self.stopping = true }

# Accept an optional job argument for compatibility with Rails main, which
# began passing the running job to +queue_adapter.stopping?+ so adapters can
# decide whether to checkpoint based on it. We rely solely on the worker
# shutdown flag, so the argument is ignored.
def stopping?(_job = nil)
self.class.stopping
end

def enqueue_after_transaction_commit?
true
end
Expand Down
Loading