class GoodJob::Scheduler::ThreadPoolExecutor

Custom sub-class of Concurrent::ThreadPoolExecutor to add additional worker status. @private

Public Instance Methods

ready_worker_count() click to toggle source

Number of inactive threads available to execute tasks. github.com/ruby-concurrency/concurrent-ruby/issues/684#issuecomment-427594437 @return [Integer]

    # File lib/good_job/scheduler.rb
268 def ready_worker_count
269   synchronize do
270     if Concurrent.on_jruby?
271       @executor.getMaximumPoolSize - @executor.getActiveCount
272     else
273       workers_still_to_be_created = @max_length - @pool.length
274       workers_created_but_waiting = @ready.length
275       workers_still_to_be_created + workers_created_but_waiting
276     end
277   end
278 end