Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
feat: add "concurrent_adapters" to configuration file
Lars Wirzenius committed 1 year ago
commit 5ce95bc360c4f20b2f21952667e7b9be818e876a
parent d90b609b41ef3b7a8b59026f2cae85b9d99b23db
2 files changed +10 -0
modified doc/userguide.md
@@ -201,6 +201,7 @@ The configuration fields are:
| field | summary |
|:------|:--------|
| `adapters` | list of CI adapters |
+
| `concurrent_adapters` | max number of adapters to run at the same time |
| `db` | database |
| `default_adapter` |  this will become deprecated, use `triggers` instead |
| `filters` | this will become deprecated, use `triggers` instead |
modified src/config.rs
@@ -37,6 +37,8 @@ pub struct Config {
    #[serde(deserialize_with = "deserialize_duration")]
    #[serde(default = "default_queue_len_interval")]
    queue_len_interval: Duration,
+

+
    concurrent_adapters: Option<usize>,
}

fn default_max_run_time() -> Duration {
@@ -58,6 +60,13 @@ impl Config {
        self.report_dir.as_deref()
    }

+
    pub fn concurrent_adapters(&self) -> usize {
+
        match &self.concurrent_adapters {
+
            None | Some(0) => 1,
+
            Some(n) => *n,
+
        }
+
    }
+

    pub fn to_adapters(&self) -> Result<Adapters, AdapterError> {
        Adapters::new(&self.adapters, self.default_adapter.as_deref())
    }