mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 18:38:21 +00:00
Differentiate startup and compile timeouts (#6958)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Separate exceptions for different timeouts to make it easier to debug issues like #6105. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan <!-- How was it tested? --> Not tested at all.
This commit is contained in:
parent
9e34c42cec
commit
01f4beeafe
1 changed files with 5 additions and 3 deletions
|
@ -48,7 +48,9 @@ pub enum CompileError {
|
|||
err: Box<Self>,
|
||||
},
|
||||
#[error("Bytecode timed out ({}s)", _0.as_secs_f32())]
|
||||
Timeout(Duration),
|
||||
CompileTimeout(Duration),
|
||||
#[error("Python startup timed out ({}s)", _0.as_secs_f32())]
|
||||
StartupTimeout(Duration),
|
||||
}
|
||||
|
||||
/// Bytecode compile all file in `dir` using a pool of Python interpreters running a Python script
|
||||
|
@ -194,7 +196,7 @@ async fn worker(
|
|||
let (mut bytecode_compiler, child_stdin, mut child_stdout, mut child_stderr) =
|
||||
tokio::time::timeout(COMPILE_TIMEOUT, wait_until_ready)
|
||||
.await
|
||||
.map_err(|_| CompileError::Timeout(COMPILE_TIMEOUT))??;
|
||||
.map_err(|_| CompileError::StartupTimeout(COMPILE_TIMEOUT))??;
|
||||
|
||||
let stderr_reader = tokio::task::spawn(async move {
|
||||
let mut child_stderr_collected: Vec<u8> = Vec::new();
|
||||
|
@ -355,7 +357,7 @@ async fn worker_main_loop(
|
|||
// should ever take.
|
||||
tokio::time::timeout(COMPILE_TIMEOUT, python_handle)
|
||||
.await
|
||||
.map_err(|_| CompileError::Timeout(COMPILE_TIMEOUT))??;
|
||||
.map_err(|_| CompileError::CompileTimeout(COMPILE_TIMEOUT))??;
|
||||
|
||||
// This is a sanity check, if we don't get the path back something has gone wrong, e.g.
|
||||
// we're not actually running a python interpreter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue