Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/datadog/di/probe_notifier_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def initialize(settings, transport, logger, telemetry: nil)
@sleep_remaining = nil
@wake_scheduled = false
@thread = nil
@pid = nil
@flush = 0
end

Expand All @@ -44,7 +45,7 @@ def initialize(settings, transport, logger, telemetry: nil)
attr_reader :telemetry

def start
return if @thread
return if @thread && @pid == Process.pid
@thread = Thread.new do
loop do
# TODO If stop is requested, we stop immediately without
Expand Down Expand Up @@ -86,6 +87,7 @@ def start
wake.wait(more ? min_send_interval : nil)
end
end
@pid = Process.pid
end

# Stops the background thread.
Expand Down Expand Up @@ -200,6 +202,10 @@ def io_in_progress?
wake.signal
end
end

# Worker could be not running if the process forked - check and
# start it again in this case.
start
end

# Determine how much longer the worker thread should sleep
Expand Down
Loading