Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
config: add gc interval limit
◌ CI pending Quaylyn Rimer committed 2 months ago
commit 19328a86b46fce7f47eb41e26ff90559d9a11201
parent b48d2d4e44a7341c734eef43a992ed82694c6b06
1 pending (1 total) View logs
3 files changed +29 -2
modified crates/radicle-cli/examples/rad-config.md
@@ -47,6 +47,7 @@ $ rad config
        "inbound": 128,
        "outbound": 16
      },
+
      "gcInterval": 600,
      "fetchPackReceive": "500.0 MiB"
    },
    "workers": 8,
modified crates/radicle-node/src/runtime.rs
@@ -36,7 +36,7 @@ use crate::reactor::Reactor;
use crate::service::gossip;
use crate::wire::Wire;
use crate::worker;
-
use crate::{service, LocalDuration, LocalTime};
+
use crate::{service, LocalTime};

pub use handle::Error as HandleError;
pub use handle::Handle;
@@ -242,7 +242,7 @@ impl Runtime {
            limit: FetchLimit::default(),
            local: nid,
            expiry: worker::garbage::Expiry::default(),
-
            gc_interval: LocalDuration::from_mins(10),
+
            gc_interval: config.limits.gc_interval.into(),
        };
        let pool = worker::Pool::with(
            worker_recv,
modified crates/radicle/src/node/config.rs
@@ -137,6 +137,9 @@ pub struct Limits {
    /// Connection limits.
    pub connection: ConnectionLimits,

+
    /// Minimum interval between `git gc` runs per repository.
+
    pub gc_interval: LimitGcInterval,
+

    /// Channel limits.
    pub fetch_pack_receive: FetchPackSizeLimit,
}
@@ -585,6 +588,29 @@ impl From<LimitGossipMaxAge> for LocalDuration {
    }
}

+
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Eq, PartialEq)]
+
#[serde(transparent)]
+
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
+
pub struct LimitGcInterval(localtime::LocalDuration);
+

+
impl Default for LimitGcInterval {
+
    fn default() -> Self {
+
        Self(localtime::LocalDuration::from_mins(10))
+
    }
+
}
+

+
impl From<LimitGcInterval> for LocalDuration {
+
    fn from(value: LimitGcInterval) -> Self {
+
        value.0
+
    }
+
}
+

+
impl From<LocalDuration> for LimitGcInterval {
+
    fn from(value: LocalDuration) -> Self {
+
        Self(value)
+
    }
+
}
+

/// Create a new type (`$name`) around a given type (`$type`), with a provided
/// default (`$default`).
///