Add --maximum-resolution-timeout

Fixed #1823
This commit is contained in:
Jiahao XU 2024-08-03 05:39:20 +00:00
parent ad892911c6
commit 51738a923c
5 changed files with 76 additions and 48 deletions

View file

@ -187,6 +187,14 @@ pub struct Args {
)]
pub(crate) no_discover_github_token: bool,
/// Maximum time each resolution (one for each possible target and each strategy), in seconds.
#[clap(
help_heading = "Overrides",
long,
env = "BINSTALL_MAXIMUM_RESOLUTION_TIMEOUT"
)]
pub(crate) maximum_resolution_timeout: Option<NonZeroU16>,
/// This flag is now enabled by default thus a no-op.
///
/// By default, Binstall will install a binary as-is in the install path.

View file

@ -2,6 +2,7 @@ use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
use binstalk::{
@ -208,6 +209,11 @@ pub fn install_crates(
SignaturePolicy::IfPresent
},
disable_telemetry: args.disable_telemetry,
maximum_resolution_timeout: args
.maximum_resolution_timeout
.map(|n| Duration::from_secs(n.get().into()))
.unwrap_or(Duration::from_secs(180)),
});
// Destruct args before any async function to reduce size of the future