diff --git a/lib/ddtrace/contrib/resque/resque_job.rb b/lib/ddtrace/contrib/resque/resque_job.rb index e376535deca..d3eac5bd4bb 100644 --- a/lib/ddtrace/contrib/resque/resque_job.rb +++ b/lib/ddtrace/contrib/resque/resque_job.rb @@ -16,26 +16,18 @@ def around_perform(*args) yield span.service = pin.service end + ensure + pin.tracer.shutdown! if pin && pin.tracer end end end end end -Resque.before_first_fork do - pin = Datadog::Pin.get_from(Resque) - next unless pin && pin.tracer - - # Create SyncWriter instance before forking - sync_writer = Datadog::SyncWriter.new(transport: pin.tracer.writer.transport) - Datadog::Contrib::Resque.sync_writer = sync_writer -end - Resque.after_fork do # get the current tracer pin = Datadog::Pin.get_from(Resque) next unless pin && pin.tracer # clean the state so no CoW happens pin.tracer.provider.context = nil - pin.tracer.writer = Datadog::Contrib::Resque.sync_writer end