Skip to content

Commit

Permalink
fix(forge): set script verification retries at 5 with a 5 second delay (
Browse files Browse the repository at this point in the history
#2739)

* 5 retries with 5s delay for forge script verification

* set default on RetryArgs instead
  • Loading branch information
joshieDo committed Aug 12, 2022
1 parent ff63aeb commit e530c73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cli/src/cmd/forge/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use serde_json::json;
use std::{path::PathBuf, sync::Arc};
use tracing::log::trace;

pub const RETRY_VERIFY_ON_CREATE: RetryArgs = RetryArgs { retries: 15, delay: Some(3) };
pub const RETRY_VERIFY_ON_CREATE: RetryArgs = RetryArgs { retries: 15, delay: 3 };

#[derive(Debug, Clone, Parser)]
pub struct CreateArgs {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cmd/forge/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use tracing::{trace, warn};
pub static RE_BUILD_COMMIT: Lazy<Regex> =
Lazy::new(|| Regex::new(r#"(?P<commit>commit\.[0-9,a-f]{8})"#).unwrap());

pub const RETRY_CHECK_ON_VERIFY: RetryArgs = RetryArgs { retries: 6, delay: Some(10) };
pub const RETRY_CHECK_ON_VERIFY: RetryArgs = RetryArgs { retries: 6, delay: 10 };

/// Verification arguments
#[derive(Debug, Clone, Parser)]
Expand Down
7 changes: 4 additions & 3 deletions cli/src/cmd/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub struct RetryArgs {
#[clap(
long,
help = "Number of attempts for retrying verification",
default_value = "1",
default_value = "5",
validator = u32_validator(1, 10),
value_name = "RETRIES"
)]
Expand All @@ -127,10 +127,11 @@ pub struct RetryArgs {
#[clap(
long,
help = "Optional delay to apply inbetween verification attempts in seconds.",
default_value = "5",
validator = u32_validator(0, 30),
value_name = "DELAY"
)]
pub delay: Option<u32>,
pub delay: u32,
}

fn u32_validator(min: u32, max: u32) -> impl FnMut(&str) -> eyre::Result<()> {
Expand All @@ -146,7 +147,7 @@ fn u32_validator(min: u32, max: u32) -> impl FnMut(&str) -> eyre::Result<()> {

impl From<RetryArgs> for Retry {
fn from(r: RetryArgs) -> Self {
Retry::new(r.retries, r.delay)
Retry::new(r.retries, Some(r.delay))
}
}

Expand Down

0 comments on commit e530c73

Please sign in to comment.