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
10
src/main.rs
10
src/main.rs
|
|
@ -260,6 +260,7 @@ async fn main() -> Result<()> {
|
|||
tokio::time::sleep(std::time::Duration::from_secs(300)).await;
|
||||
let mut e = engine.lock().await;
|
||||
e.persist_stats(); // snapshot counters so a crash loses at most ~5 min
|
||||
e.persist_incidents(); // and the LOGSEARCH incident ring
|
||||
e.expire_sweep();
|
||||
if let Err(err) = e.maybe_compact() {
|
||||
tracing::warn!(%err, "compaction failed");
|
||||
|
|
@ -300,8 +301,13 @@ async fn main() -> Result<()> {
|
|||
tokio::select! {
|
||||
res = link::run(proto, engine, &addr, irc_rx, irc_tx, cfg.email.clone(), cfg.keycard.clone(), cfg.dictserv.as_ref().map(|d| d.server.clone())) => res,
|
||||
_ = shutdown_signal() => {
|
||||
// Flush stat counters so a clean stop/restart keeps StatServ history.
|
||||
shutdown_engine.lock().await.persist_stats();
|
||||
// Flush stat counters + the incident ring so a clean stop/restart keeps
|
||||
// StatServ history and OperServ LOGSEARCH.
|
||||
{
|
||||
let mut e = shutdown_engine.lock().await;
|
||||
e.persist_stats();
|
||||
e.persist_incidents();
|
||||
}
|
||||
tracing::info!("received shutdown signal, exiting");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue