Skip to content

Commit 9d3d968

Browse files
committed
puts timeout on telemetry finish
1 parent f36c0bf commit 9d3d968

File tree

1 file changed

+4
-1
lines changed
  • crates/chat-cli/src/telemetry

1 file changed

+4
-1
lines changed

crates/chat-cli/src/telemetry/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub use install_method::{
3636
};
3737
use tokio::sync::mpsc;
3838
use tokio::task::JoinHandle;
39+
use tokio::time::error::Elapsed;
3940
use tracing::{
4041
debug,
4142
error,
@@ -75,6 +76,8 @@ pub enum TelemetryError {
7576
Join(#[from] tokio::task::JoinError),
7677
#[error(transparent)]
7778
Database(#[from] DatabaseError),
79+
#[error(transparent)]
80+
Timeout(#[from] Elapsed),
7881
}
7982

8083
impl From<amzn_toolkit_telemetry_client::operation::post_metrics::PostMetricsError> for TelemetryError {
@@ -159,7 +162,7 @@ impl TelemetryThread {
159162
pub async fn finish(self) -> Result<(), TelemetryError> {
160163
drop(self.tx);
161164
if let Some(handle) = self.handle {
162-
handle.await?;
165+
let _ = tokio::time::timeout(std::time::Duration::from_millis(100), handle).await;
163166
}
164167

165168
Ok(())

0 commit comments

Comments
 (0)