Module: Datadog::Core::Workers::Polling Private
- Included in:
- Telemetry::Worker, RuntimeMetrics, DataStreams::Processor, OpenFeature::Exposures::Worker, Profiling::Scheduler, Tracing::Workers::AsyncTraceWriter
- Defined in:
- lib/datadog/core/workers/polling.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds polling (async looping) behavior to workers
Defined Under Namespace
Modules: PrependedMethods
Constant Summary collapse
- DEFAULT_SHUTDOWN_TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1
Class Method Summary collapse
- .included(base) ⇒ Object private
Instance Method Summary collapse
-
#enabled=(value) ⇒ Object
private
Allow worker to be started.
- #enabled? ⇒ Boolean private
- #stop(force_stop = false, timeout = DEFAULT_SHUTDOWN_TIMEOUT) ⇒ Object private
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 |
# File 'lib/datadog/core/workers/polling.rb', line 15 def self.included(base) base.include(Workers::IntervalLoop) base.include(Workers::Async::Thread) base.prepend(PrependedMethods) end |
Instance Method Details
#enabled=(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allow worker to be started
54 55 56 57 |
# File 'lib/datadog/core/workers/polling.rb', line 54 def enabled=(value) # Coerce to boolean @enabled = (value == true) end |
#enabled? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 |
# File 'lib/datadog/core/workers/polling.rb', line 47 def enabled? return true unless instance_variable_defined?(:@enabled) @enabled end |
#stop(force_stop = false, timeout = DEFAULT_SHUTDOWN_TIMEOUT) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/datadog/core/workers/polling.rb', line 28 def stop(force_stop = false, timeout = DEFAULT_SHUTDOWN_TIMEOUT) if running? # Attempt graceful stop and wait stop_loop graceful = join(timeout) if !graceful && force_stop Datadog.logger.debug do "Timeout while waiting for worker to finish gracefully, forcing termination for: #{self}" end terminate else graceful end else false end end |