module Datadog::Workers::Polling
Adds polling (async looping) behavior to workers
Constants
- SHUTDOWN_TIMEOUT
Public Class Methods
included(base)
click to toggle source
# File lib/ddtrace/workers/polling.rb, line 10 def self.included(base) base.send(:include, Workers::IntervalLoop) base.send(:include, Workers::Async::Thread) base.send(:prepend, PrependedMethods) end
Public Instance Methods
enabled=(value)
click to toggle source
Allow worker to be started
# File lib/ddtrace/workers/polling.rb, line 42 def enabled=(value) # Coerce to boolean @enabled = (value == true) end
enabled?()
click to toggle source
# File lib/ddtrace/workers/polling.rb, line 36 def enabled? return true unless instance_variable_defined?(:@enabled) @enabled end
stop(force_stop = false, timeout = SHUTDOWN_TIMEOUT)
click to toggle source
# File lib/ddtrace/workers/polling.rb, line 23 def stop(force_stop = false, timeout = SHUTDOWN_TIMEOUT) if running? # Attempt graceful stop and wait stop_loop graceful = join(timeout) # If timeout and force stop... !graceful && force_stop ? terminate : graceful else false end end