mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-14 23:22:51 +00:00
Fix __send_analytics to delete event file on deserialization failure
The file was only deleted after successful deserialization + send. Wrap the read/deserialize/send in an async block so remove_file runs regardless of where the error occurs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2735e1fc9b
commit
490dc2e5eb
1 changed files with 6 additions and 3 deletions
|
|
@ -485,9 +485,12 @@ async fn main_inner() -> Result<()> {
|
|||
}
|
||||
},
|
||||
Command::SendAnalytics { path } => {
|
||||
let json = std::fs::read(&path)?;
|
||||
let track: arc_util::telemetry::event::Track = serde_json::from_slice(&json)?;
|
||||
let result = arc_util::telemetry::sender::send_to_segment(&track).await;
|
||||
let result = async {
|
||||
let json = std::fs::read(&path)?;
|
||||
let track: arc_util::telemetry::event::Track = serde_json::from_slice(&json)?;
|
||||
arc_util::telemetry::sender::send_to_segment(&track).await
|
||||
}
|
||||
.await;
|
||||
let _ = std::fs::remove_file(&path);
|
||||
result?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue