2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-09 22:14:59 +00:00

Don't kill already-exited processes, don't log tmp_dir when fetching details

This commit is contained in:
asonix 2023-12-23 13:29:30 -06:00
parent 8a55bc5e6c
commit 6d259a0eea
2 changed files with 11 additions and 13 deletions

View file

@ -1121,7 +1121,7 @@ async fn details_query<S: Store + 'static>(
}
/// Fetch file details
#[tracing::instrument(name = "Fetching details", skip(repo, store, config))]
#[tracing::instrument(name = "Fetching details", skip(tmp_dir, repo, store, config))]
async fn details<S: Store + 'static>(
alias: web::Path<Serde<Alias>>,
tmp_dir: web::Data<ArcTmpDir>,

View file

@ -223,8 +223,7 @@ impl Process {
Ok(Ok(status)) => Err(ProcessError::Status(command, status)),
Ok(Err(e)) => Err(ProcessError::Other(e)),
Err(_) => {
child.kill().await.map_err(ProcessError::Other)?;
let _ = child.kill().await;
Err(ProcessError::Timeout(command))
}
}
@ -268,19 +267,18 @@ impl Process {
child.wait().await
};
let error = match child_fut.with_timeout(timeout).await {
match child_fut.with_timeout(timeout).await {
Ok(Ok(status)) if status.success() => {
guard.disarm();
return Ok(());
Ok(())
}
Ok(Ok(status)) => ProcessError::Status(command2, status),
Ok(Err(e)) => ProcessError::Other(e),
Err(_) => ProcessError::Timeout(command2),
};
Ok(Ok(status)) => Err(ProcessError::Status(command2, status)),
Ok(Err(e)) => Err(ProcessError::Other(e)),
Err(_) => {
child.kill().await.map_err(ProcessError::Other)?;
Err(error)
Err(ProcessError::Timeout(command2))
}
}
});
ProcessRead {