lib/good_job/adapter.rb in good_job-3.18.0 vs lib/good_job/adapter.rb in good_job-3.18.1

- old
+ new

@@ -183,19 +183,19 @@ # Whether in +:async+ execution mode. # @return [Boolean] def execute_async? execution_mode == :async_all || - (execution_mode.in?([:async, :async_server]) && in_server_process?) + (execution_mode.in?([:async, :async_server]) && GoodJob.configuration.in_webserver?) end # Whether in +:external+ execution mode. # @return [Boolean] def execute_externally? execution_mode.nil? || execution_mode == :external || - (execution_mode.in?([:async, :async_server]) && !in_server_process?) + (execution_mode.in?([:async, :async_server]) && !GoodJob.configuration.in_webserver?) end # Whether in +:inline+ execution mode. # @return [Boolean] def execute_inline? @@ -216,24 +216,9 @@ def async_started? @_async_started end private - - # Whether running in a web server process. - # @return [Boolean, nil] - def in_server_process? - return @_in_server_process if defined? @_in_server_process - - @_in_server_process = Rails.const_defined?(:Server) || begin - self_caller = caller - - self_caller.grep(%r{config.ru}).any? || # EXAMPLE: config.ru:3:in `block in <main>' OR config.ru:3:in `new_from_string' - self_caller.grep(%r{puma/request}).any? || # EXAMPLE: puma-5.6.4/lib/puma/request.rb:76:in `handle_request' - self_caller.grep(%{/rack/handler/}).any? || # EXAMPLE: iodine-0.7.44/lib/rack/handler/iodine.rb:13:in `start' - (Concurrent.on_jruby? && self_caller.grep(%r{jruby/rack/rails_booter}).any?) # EXAMPLE: uri:classloader:/jruby/rack/rails_booter.rb:83:in `load_environment' - end - end def send_notify?(active_job) return false unless GoodJob.configuration.enable_listen_notify return true unless active_job.respond_to?(:good_job_notify)