Method: Datadog::Core::Workers::Polling#stop

Defined in:
lib/datadog/core/workers/polling.rb

#stop(force_stop = false, timeout = DEFAULT_SHUTDOWN_TIMEOUT) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/datadog/core/workers/polling.rb', line 26

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