feat: deprecate the status_update_interval_seconds config field

It has never actually been used.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2025-07-30 11:45:22 +03:00
parent 5c10459d90
commit 6909e4659b
3 changed files with 28 additions and 11 deletions
+1 -2
View File
@@ -265,7 +265,6 @@ The output will be in JSON (which also works as YAML input):
"filters": [],
"triggers": null,
"report_dir": "html",
"status_update_interval_seconds": null,
"db": "x.db",
"max_run_time": {
"secs": 3600,
@@ -290,7 +289,7 @@ The configuration fields are:
| `max_run_time` | maximum duration of a CI run |
| `queue_len_interval` | how often the event queue length should be logged |
| `report_dir` | directory where HTML and JSON report pages are written |
| `status_update_interval_seconds` | how often should `status.json` be updated? |
| `status_update_interval_seconds` | deprecated and ignore |
| `triggers` | see [the "Triggering CI" chapter](#triggers) |
The items in the `adapters` list may use the following fields:
+15 -9
View File
@@ -12,12 +12,12 @@ use serde::{Deserialize, Serialize};
use crate::{
adapter::{Adapter, AdapterError, Adapters},
filter::{EventFilter, Trigger},
logger,
sensitive::Sensitive,
};
const DEFAULT_MAX_RUN_TIME: Duration = Duration::from_secs(3600);
const DEFAULT_QUEUE_LEN_INTERVAL: Duration = Duration::from_secs(3600);
const DEFAULT_STATUS_PAGE_UPDATE_INTERVAL: u64 = 10;
#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
@@ -25,9 +25,16 @@ pub struct Config {
default_adapter: Option<String>,
triggers: Option<Vec<TriggerConfig>>,
report_dir: Option<PathBuf>,
status_update_interval_seconds: Option<u64>,
db: PathBuf,
// This isn't actually used. The status page is updated about once
// a second, see `UPDATE_IMTERVAL` in `src/notif.rs`. However, we
// don't want to break existing configuration files, so we allow
// it. We just don't use it anywhere.
#[allow(dead_code)]
#[serde(skip)]
status_update_interval_seconds: Option<u64>,
#[serde(default)]
adapters: HashMap<String, AdapterSpec>,
@@ -60,11 +67,15 @@ impl Config {
std::fs::read(filename).map_err(|e| ConfigError::ReadConfig(filename.into(), e))?;
let config: Config = serde_yml::from_slice(&config)
.map_err(|e| ConfigError::ParseConfig(filename.into(), e))?;
config.check()?;
config.check(filename)?;
Ok(config)
}
fn check(&self) -> Result<(), ConfigError> {
fn check(&self, filename: &Path) -> Result<(), ConfigError> {
if self.status_update_interval_seconds.is_some() {
logger::config_deprecated("status_update_interval_seconds", filename);
}
if let Some(triggers) = &self.triggers {
for trigger in triggers.iter() {
if !self.adapters.contains_key(&trigger.adapter) {
@@ -103,11 +114,6 @@ impl Config {
.collect()
}
pub fn status_page_update_interval(&self) -> u64 {
self.status_update_interval_seconds
.unwrap_or(DEFAULT_STATUS_PAGE_UPDATE_INTERVAL)
}
pub fn max_run_time(&self) -> Duration {
self.max_run_time
}
+12
View File
@@ -134,6 +134,8 @@ enum Id {
CibEndSuccess,
CibStart,
ConfigDeprecated,
JobCreate,
JobFailure,
JobRunCreate,
@@ -335,6 +337,16 @@ pub fn end_cib_in_error() {
);
}
pub fn config_deprecated(field: &'static str, filename: &Path) {
warn!(
msg_id = ?Id::ConfigDeprecated,
kind = %Kind::Startup,
field,
?filename,
"configuration field is deprecated and ignored",
);
}
pub fn node_event_source_created(source: &NodeEventSource) {
debug!(
msg_id = ?Id::NodeEventSourceCreated,