From 5dfca6cc11897a439cd52d9ef2ee439d1dcced1c Mon Sep 17 00:00:00 2001 From: Jules Wiriath Date: Wed, 13 May 2026 18:57:54 +0200 Subject: [PATCH] fix(trace_exporter: shared_runtime): unwrap_or being eager is not good --- libdd-data-pipeline/src/trace_exporter/builder.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libdd-data-pipeline/src/trace_exporter/builder.rs b/libdd-data-pipeline/src/trace_exporter/builder.rs index bd157abe8d..ecc8dad0f8 100644 --- a/libdd-data-pipeline/src/trace_exporter/builder.rs +++ b/libdd-data-pipeline/src/trace_exporter/builder.rs @@ -298,13 +298,12 @@ impl TraceExporterBuilder { )); } - let shared_runtime = - self.shared_runtime - .unwrap_or(Arc::new(SharedRuntime::new().map_err(|e| { - TraceExporterError::Builder(BuilderErrorKind::InvalidConfiguration( - e.to_string(), - )) - })?)); + let shared_runtime = match self.shared_runtime { + Some(rt) => rt, + None => Arc::new(SharedRuntime::new().map_err(|e| { + TraceExporterError::Builder(BuilderErrorKind::InvalidConfiguration(e.to_string())) + })?), + }; let dogstatsd = self.dogstatsd_url.and_then(|u| { new(Endpoint::from_slice(&u)).ok() // If we couldn't set the endpoint return