Skip to content

Commit 8404276

Browse files
committed
Wait for telemetry client to finish so the metrics are flushed.
1 parent faad98b commit 8404276

File tree

1 file changed

+4
-11
lines changed
  • data-pipeline/src/telemetry

1 file changed

+4
-11
lines changed

data-pipeline/src/telemetry/mod.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,18 @@ impl TelemetryClient {
169169
self.handle.abort();
170170
}
171171
}
172+
172173
/// Shutdowns the telemetry client.
173-
pub async fn shutdown(&self) {
174+
pub async fn shutdown(self) {
174175
if let Err(_e) = self
175176
.worker
176177
.send_msg(TelemetryActions::Lifecycle(LifecycleAction::Stop))
177178
.await
178179
{
179180
self.handle.abort();
180181
}
182+
183+
let _ = self.handle.await;
181184
}
182185
}
183186

@@ -264,7 +267,6 @@ mod tests {
264267
client.start().await;
265268
let _ = client.send(&data);
266269
client.shutdown().await;
267-
let _ = client.handle.await;
268270
telemetry_srv.assert_hits_async(1).await;
269271
}
270272

@@ -304,7 +306,6 @@ mod tests {
304306
client.start().await;
305307
let _ = client.send(&data);
306308
client.shutdown().await;
307-
let _ = client.handle.await;
308309
telemetry_srv.assert_hits_async(1).await;
309310
}
310311

@@ -344,7 +345,6 @@ mod tests {
344345
client.start().await;
345346
let _ = client.send(&data);
346347
client.shutdown().await;
347-
let _ = client.handle.await;
348348
telemetry_srv.assert_hits_async(1).await;
349349
}
350350

@@ -384,7 +384,6 @@ mod tests {
384384
client.start().await;
385385
let _ = client.send(&data);
386386
client.shutdown().await;
387-
let _ = client.handle.await;
388387
telemetry_srv.assert_hits_async(1).await;
389388
}
390389

@@ -424,7 +423,6 @@ mod tests {
424423
client.start().await;
425424
let _ = client.send(&data);
426425
client.shutdown().await;
427-
let _ = client.handle.await;
428426
telemetry_srv.assert_hits_async(1).await;
429427
}
430428

@@ -464,7 +462,6 @@ mod tests {
464462
client.start().await;
465463
let _ = client.send(&data);
466464
client.shutdown().await;
467-
let _ = client.handle.await;
468465
telemetry_srv.assert_hits_async(1).await;
469466
}
470467

@@ -504,7 +501,6 @@ mod tests {
504501
client.start().await;
505502
let _ = client.send(&data);
506503
client.shutdown().await;
507-
let _ = client.handle.await;
508504
telemetry_srv.assert_hits_async(1).await;
509505
}
510506

@@ -544,7 +540,6 @@ mod tests {
544540
client.start().await;
545541
let _ = client.send(&data);
546542
client.shutdown().await;
547-
let _ = client.handle.await;
548543
telemetry_srv.assert_hits_async(1).await;
549544
}
550545

@@ -577,8 +572,6 @@ mod tests {
577572

578573
client.start().await;
579574
client.shutdown().await;
580-
let _ = client.handle.await;
581-
582575
// Check for 2 hits: app-started and app-closing.
583576
telemetry_srv.assert_hits_async(2).await;
584577
}

0 commit comments

Comments
 (0)