mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-28 10:50:29 +00:00
Add UV_CONCURRENT_INSTALLS variable in favor of RAYON_NUM_THREADS (#3646)
## Summary Continuation of https://github.com/astral-sh/uv/pull/3493. This gives us more flexibility in case we decide to move away from `rayon` in the future.
This commit is contained in:
parent
fe2bc079bc
commit
53633392c3
9 changed files with 50 additions and 7 deletions
|
|
@ -11,13 +11,18 @@ pub struct Concurrency {
|
|||
///
|
||||
/// Note this value must be non-zero.
|
||||
pub builds: usize,
|
||||
/// The maximum number of concurrent installs.
|
||||
///
|
||||
/// Note this value must be non-zero.
|
||||
pub installs: usize,
|
||||
}
|
||||
|
||||
impl Default for Concurrency {
|
||||
fn default() -> Self {
|
||||
Concurrency {
|
||||
downloads: Concurrency::DEFAULT_DOWNLOADS,
|
||||
builds: Concurrency::default_builds(),
|
||||
builds: Concurrency::threads(),
|
||||
installs: Concurrency::threads(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,8 +31,8 @@ impl Concurrency {
|
|||
// The default concurrent downloads limit.
|
||||
pub const DEFAULT_DOWNLOADS: usize = 50;
|
||||
|
||||
// The default concurrent builds limit.
|
||||
pub fn default_builds() -> usize {
|
||||
// The default concurrent builds and install limit.
|
||||
pub fn threads() -> usize {
|
||||
std::thread::available_parallelism()
|
||||
.map(NonZeroUsize::get)
|
||||
.unwrap_or(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue