Skip to content

Commit 6021b3d

Browse files
p-datadogp
andauthored
DEBUG-3457 start DI probe notifier worker on every event submission (#4363)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent 07a0720 commit 6021b3d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/datadog/di/probe_notifier_worker.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def initialize(settings, transport, logger, telemetry: nil)
3636
@sleep_remaining = nil
3737
@wake_scheduled = false
3838
@thread = nil
39+
@pid = nil
3940
@flush = 0
4041
end
4142

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

4647
def start
47-
return if @thread
48+
return if @thread && @pid == Process.pid
4849
@thread = Thread.new do
4950
loop do
5051
# TODO If stop is requested, we stop immediately without
@@ -86,6 +87,7 @@ def start
8687
wake.wait(more ? min_send_interval : nil)
8788
end
8889
end
90+
@pid = Process.pid
8991
end
9092

9193
# Stops the background thread.
@@ -200,6 +202,10 @@ def io_in_progress?
200202
wake.signal
201203
end
202204
end
205+
206+
# Worker could be not running if the process forked - check and
207+
# start it again in this case.
208+
start
203209
end
204210

205211
# Determine how much longer the worker thread should sleep

0 commit comments

Comments
 (0)