pub fn expired<'a>(
now: DateTime<Utc>,
deadlines: &HashMap<String, String>,
agents: impl IntoIterator<Item = &'a Agent>,
) -> Vec<(String, String)>Expand description
Which agents have passed their deadline and should be killed now.
Pure so the decision is testable without sleeping: callers pass now and
the deadlines they know about.
- A terminal agent is never selected: it has already stopped, and emitting a timeout for it would add a lie to the log.
- An agent with no deadline is never selected — a timeout is opt-in.
- An unparseable deadline is ignored rather than treated as expired. Failing the other way would kill a healthy agent because of a bad string.