statserv: persist per-channel activity across restart too
All checks were successful
CI / check (push) Successful in 3m49s
All checks were successful
CI / check (push) Successful in 3m49s
The earlier StatsSet fix persisted only the shared namespaced counters. The per-channel BOTSTATS view (lines seen + top talkers, from /statserv #chan) lived on the LiveChannel struct, which is rebuilt from each burst — so it reset to zero on restart. Move it to a name-keyed Network.chan_activity map (independent of live membership, seedable before the burst) and carry it in the StatsSet snapshot (new serde-default `channels` field) alongside the counters. Reworded the notice from 'seen this session' now that it persists.
This commit is contained in:
parent
8a9b6a37ca
commit
1f6a11dba2
8 changed files with 91 additions and 26 deletions
|
|
@ -532,13 +532,15 @@
|
|||
let p = tmp("statspersist");
|
||||
let counters: std::collections::BTreeMap<String, u64> =
|
||||
[("chanserv.register".to_string(), 7u64), ("nickserv.identify".to_string(), 42u64)].into_iter().collect();
|
||||
let chans = vec![("#devs".to_string(), 6u64, vec![("reverse".to_string(), 5u64), ("Keiko".to_string(), 1u64)])];
|
||||
{
|
||||
let mut db = Db::open(&p, "N1");
|
||||
db.persist_stats(&counters).unwrap();
|
||||
db.persist_stats(&counters, chans.clone()).unwrap();
|
||||
assert_eq!(db.persisted_stats(), counters, "stored while live");
|
||||
}
|
||||
let db = Db::open(&p, "N1");
|
||||
assert_eq!(db.persisted_stats(), counters, "counters replay from the log after a restart");
|
||||
assert_eq!(db.persisted_chan_stats(), chans, "per-channel activity replays too");
|
||||
}
|
||||
|
||||
// Fold parity: the live state after a broad sequence of writes must equal the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue