Skip to content

Commit 68c6519

Browse files
authored
fix(trace_exporter: shared_runtime): unwrap_or being eager is not good (#1983)
Co-authored-by: jules.wiriath <jules.wiriath@datadoghq.com>
1 parent ec2fd4e commit 68c6519

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

libdd-data-pipeline/src/trace_exporter/builder.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,12 @@ impl TraceExporterBuilder {
298298
));
299299
}
300300

301-
let shared_runtime =
302-
self.shared_runtime
303-
.unwrap_or(Arc::new(SharedRuntime::new().map_err(|e| {
304-
TraceExporterError::Builder(BuilderErrorKind::InvalidConfiguration(
305-
e.to_string(),
306-
))
307-
})?));
301+
let shared_runtime = match self.shared_runtime {
302+
Some(rt) => rt,
303+
None => Arc::new(SharedRuntime::new().map_err(|e| {
304+
TraceExporterError::Builder(BuilderErrorKind::InvalidConfiguration(e.to_string()))
305+
})?),
306+
};
308307

309308
let dogstatsd = self.dogstatsd_url.and_then(|u| {
310309
new(Endpoint::from_slice(&u)).ok() // If we couldn't set the endpoint return

0 commit comments

Comments
 (0)