lib/good_job/scheduler.rb in good_job-1.3.6 vs lib/good_job/scheduler.rb in good_job-1.4.0

- old
+ new

@@ -20,11 +20,11 @@ name: name, min_threads: 0, max_threads: Configuration::DEFAULT_MAX_THREADS, auto_terminate: true, idletime: 60, - max_queue: -1, + max_queue: 0, fallback_policy: :discard, }.freeze # @!attribute [r] instances # @!scope class @@ -168,13 +168,16 @@ # Number of inactive threads available to execute tasks. # https://github.com/ruby-concurrency/concurrent-ruby/issues/684#issuecomment-427594437 # @return [Integer] def ready_worker_count synchronize do - workers_still_to_be_created = @max_length - @pool.length - workers_created_but_waiting = @ready.length - - workers_still_to_be_created + workers_created_but_waiting + if Concurrent.on_jruby? + @executor.getMaximumPoolSize - @executor.getActiveCount + else + workers_still_to_be_created = @max_length - @pool.length + workers_created_but_waiting = @ready.length + workers_still_to_be_created + workers_created_but_waiting + end end end end end end