Class: GoodJob::Scheduler::ThreadPoolExecutor
- Inherits:
-
Concurrent::ThreadPoolExecutor
- Object
- Concurrent::ThreadPoolExecutor
- GoodJob::Scheduler::ThreadPoolExecutor
- Defined in:
- lib/good_job/scheduler.rb
Overview
Custom sub-class of Concurrent::ThreadPoolExecutor
to add additional worker status.
Instance Method Summary collapse
-
#ready_worker_count ⇒ Integer
Number of inactive threads available to execute tasks.
Instance Method Details
#ready_worker_count ⇒ Integer
Number of inactive threads available to execute tasks. github.com/ruby-concurrency/concurrent-ruby/issues/684#issuecomment-427594437
323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/good_job/scheduler.rb', line 323 def ready_worker_count synchronize do 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 |