lib/good_job/poller.rb in good_job-1.9.6 vs lib/good_job/poller.rb in good_job-1.10.0
- old
+ new
@@ -3,15 +3,17 @@
module GoodJob # :nodoc:
#
# Pollers regularly wake up execution threads to check for new work.
#
class Poller
+ TIMEOUT_INTERVAL = 5
+
# Defaults for instance of Concurrent::TimerTask.
# The timer controls how and when sleeping threads check for new work.
DEFAULT_TIMER_OPTIONS = {
execution_interval: Configuration::DEFAULT_POLL_INTERVAL,
- timeout_interval: 1,
+ timeout_interval: TIMEOUT_INTERVAL,
run_now: true,
}.freeze
# @!attribute [r] instances
# @!scope class
@@ -47,12 +49,14 @@
# @return [true, false, nil]
delegate :running?, to: :timer, allow_nil: true
# Tests whether the timer is shutdown.
# @return [true, false, nil]
- delegate :shutdown?, to: :timer, allow_nil: true
+ def shutdown?
+ timer ? timer.shutdown? : true
+ end
- # Shut down the notifier.
+ # Shut down the poller.
# Use {#shutdown?} to determine whether threads have stopped.
# @param timeout [nil, Numeric] Seconds to wait for active threads.
# * +nil+, the scheduler will trigger a shutdown but not wait for it to complete.
# * +-1+, the scheduler will wait until the shutdown is complete.
# * +0+, the scheduler will immediately shutdown and stop any threads.