Skip to content

Commit

Permalink
fix deadlock issue: don't flush_events in main thread when calling st…
Browse files Browse the repository at this point in the history
…op, override #work_pending? instead
  • Loading branch information
anmarchenko committed Jun 28, 2024
1 parent bcc0acf commit c06a214
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/datadog/core/telemetry/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def start
def stop(force_stop = false, timeout = @shutdown_timeout)
buffer.close if running?

flush_events(dequeue) if work_pending?

super
end

Expand Down Expand Up @@ -136,6 +134,10 @@ def dequeue
buffer.pop
end

def work_pending?
@run_loop || !buffer.empty?
end

def buffer_klass
if Core::Environment::Ext::RUBY_ENGINE == 'ruby'
Core::Buffer::CRuby
Expand Down

0 comments on commit c06a214

Please sign in to comment.