MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / next_eval_interval_ms

Function next_eval_interval_ms

nodedb/src/event/alert/executor.rs:261–270  ·  view source on GitHub ↗

Determine the eval loop sleep interval. Uses the shortest window_ms among all enabled alerts (minimum 1s).

(registry: &AlertRegistry)

Source from the content-addressed store, hash-verified

259/// Determine the eval loop sleep interval.
260/// Uses the shortest window_ms among all enabled alerts (minimum 1s).
261fn next_eval_interval_ms(registry: &AlertRegistry) -> u64 {
262 let alerts = registry.list_all_enabled();
263 alerts
264 .iter()
265 .map(|a| a.window_ms)
266 .filter(|&ms| ms > 0)
267 .min()
268 .unwrap_or(60_000) // Default: 1 minute
269 .max(1_000) // Minimum: 1 second
270}
271
272#[cfg(test)]
273mod tests {

Callers 1

alert_eval_loopFunction · 0.85

Calls 2

list_all_enabledMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected