Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW
✗ CI failure Fintan Halpenny committed 6 months ago
commit 38624b2a6dc336215ab3bf438bf5045fdbdac1af
parent 5b0bcaf2d0ece33b6981b1d730ec29dce8af69a7
1 failed (1 total) View logs
2 files changed +19 -5
modified crates/radicle-cli/src/commands/watch.rs
@@ -32,8 +32,8 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
    };
    let repo = storage.repository(rid)?;
    let now = time::SystemTime::now();
-
    let timeout = time::Duration::from_millis(args.timeout as u64);
-
    let interval = time::Duration::from_millis(args.interval as u64);
+
    let timeout = args.timeout();
+
    let interval = args.interval();

    if let Some(target) = args.target {
        while reference(&repo, &nid, &qualified)? != Some(target) {
modified crates/radicle-cli/src/commands/watch/args.rs
@@ -1,3 +1,5 @@
+
use std::time;
+

#[allow(rustdoc::broken_intra_doc_links)]
use clap::Parser;

@@ -38,11 +40,23 @@ pub struct Args {

    /// How often, in milliseconds, to check the reference target
    #[arg(long, short, value_name = "MILLIS", default_value_t = 1000)]
-
    pub(super) interval: usize,
+
    interval: u64,

    /// Timeout, in milliseconds
-
    #[arg(long, value_name = "MILLIS", default_value_t = usize::MAX)]
-
    pub(super) timeout: usize,
+
    #[arg(long, value_name = "MILLIS")]
+
    timeout: Option<u64>,
+
}
+

+
impl Args {
+
    /// Provide the interval duration in milliseconds.
+
    pub(super) fn interval(&self) -> time::Duration {
+
        time::Duration::from_millis(self.interval)
+
    }
+

+
    /// Provide the timeout duration in milliseconds.
+
    pub(super) fn timeout(&self) -> time::Duration {
+
        time::Duration::from_millis(self.timeout.unwrap_or(u64::MAX))
+
    }
}

#[cfg(test)]