Acquire reporter lock once (#11278)

See https://github.com/astral-sh/uv/pull/11165#discussion_r1943853482
This commit is contained in:
konsti 2025-02-06 10:49:44 +01:00 committed by GitHub
parent 5ce48cf799
commit cfd1e670dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -225,9 +225,9 @@ impl ProgressReporter {
return;
};
let progress = state.lock().unwrap().bars.remove(&id).unwrap();
let size = state.lock().unwrap().download_size[&id];
let mut state = state.lock().unwrap();
let progress = state.bars.remove(&id).unwrap();
let size = state.download_size[&id];
if multi_progress.is_hidden()
&& !*HAS_UV_TEST_NO_CLI_PROGRESS
&& size.is_none_or(|size| size > 1024 * 1024)