engine: persist the incident ring (LOGSEARCH) across restarts via a periodic + on-shutdown snapshot event, mirroring stat-counter persistence
All checks were successful
CI / check (push) Successful in 3m44s
All checks were successful
CI / check (push) Successful in 3m44s
This commit is contained in:
parent
754c5d9e95
commit
a10662bbc6
9 changed files with 102 additions and 6 deletions
|
|
@ -350,6 +350,10 @@ pub struct NetData {
|
|||
pub stats: std::collections::BTreeMap<String, u64>,
|
||||
// Persisted per-channel BOTSTATS activity: (channel, lines, top talkers).
|
||||
pub chan_stats: ChanStats,
|
||||
// Persisted snapshot of the recent-incident ring (OperServ LOGSEARCH) and its
|
||||
// id counter, so the moderation trail survives a restart.
|
||||
pub incidents: Vec<(String, u64, String)>,
|
||||
pub incident_seq: u64,
|
||||
}
|
||||
|
||||
// A session-limit exception: an IP-mask glob and the session allowance for IPs
|
||||
|
|
@ -1273,6 +1277,12 @@ impl Db {
|
|||
channels: self.net.chan_stats.clone(),
|
||||
});
|
||||
}
|
||||
if !self.net.incidents.is_empty() {
|
||||
snapshot.push(Event::IncidentsSet {
|
||||
incident_seq: self.net.incident_seq,
|
||||
incidents: self.net.incidents.clone(),
|
||||
});
|
||||
}
|
||||
for host in &self.host_cfg.offers {
|
||||
snapshot.push(Event::VhostOfferAdded { host: host.clone() });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue