Skip to content

Commit 3884ab5

Browse files
authored
Fix bytecode compilation debug message introduced by #14369 (#14682)
## Summary When refactoring the addition PR I accidentally introduced a bug where the debug message would not be output if the default value is used. cc @zanieb
1 parent bdb8c26 commit 3884ab5

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

crates/uv-installer/src/compile.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,28 @@ pub async fn compile_tree(
9191
let pip_compileall_py = tempdir.path().join("pip_compileall.py");
9292

9393
let timeout: Option<Duration> = match env::var(EnvVars::UV_COMPILE_BYTECODE_TIMEOUT) {
94-
Ok(value) => {
95-
if value == "0" {
96-
debug!("Disabling bytecode compilation timeout");
97-
None
98-
} else {
99-
if let Ok(duration) = value.parse::<u64>().map(Duration::from_secs) {
100-
debug!(
101-
"Using bytecode compilation timeout of {}s",
102-
duration.as_secs()
103-
);
104-
Some(duration)
105-
} else {
94+
Ok(value) => match value.as_str() {
95+
"0" => None,
96+
_ => match value.parse::<u64>().map(Duration::from_secs) {
97+
Ok(duration) => Some(duration),
98+
Err(_) => {
10699
return Err(CompileError::EnvironmentError {
107100
var: "UV_COMPILE_BYTECODE_TIMEOUT",
108101
message: format!("Expected an integer number of seconds, got \"{value}\""),
109102
});
110103
}
111-
}
112-
}
104+
},
105+
},
113106
Err(_) => Some(DEFAULT_COMPILE_TIMEOUT),
114107
};
108+
if let Some(duration) = timeout {
109+
debug!(
110+
"Using bytecode compilation timeout of {}s",
111+
duration.as_secs()
112+
);
113+
} else {
114+
debug!("Disabling bytecode compilation timeout");
115+
}
115116

116117
debug!("Starting {} bytecode compilation workers", worker_count);
117118
let mut worker_handles = Vec::new();

0 commit comments

Comments
 (0)