Sha256: 890bc1ebd4e60e62425aec30909b03db322098e454fb095c95a590025af0d652
Contents?: true
Size: 850 Bytes
Versions: 37
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true module GoodJob # Provides methods for determining the status of the # current job execution thread. This is useful for determining # whether to continue processing a job or to shut down gracefully. module ThreadStatus extend ActiveSupport::Concern class_methods do # Whether the current job execution thread is in a running state. # @return [Boolean] def current_thread_running? scheduler = Thread.current[:good_job_scheduler] scheduler ? scheduler.running? : true end # Whether the current job execution thread is shutting down # (the opposite of running). # @return [Boolean] def current_thread_shutting_down? scheduler = Thread.current[:good_job_scheduler] scheduler && !scheduler.running? end end end end
Version data entries
37 entries across 37 versions & 1 rubygems