botserv: op assigned bots on join; statserv: persist counters across restart
Some checks failed
CI / check (push) Failing after 3m48s
Some checks failed
CI / check (push) Failing after 3m48s
Problem 1: an assigned bot joined via IJOIN with no status mode, so it had no +o. Join it with the 4-param IJOIN form (ts 1, mode o) so it's opped, matching Anope's default bot modes (+o), and exempt bots from SECUREOPS/RESTRICTED so the op is never stripped. Problem 2: the shared stat counters lived only in memory, so a restart wiped them. Snapshot them to the log (StatsSet event, folded into NetData + compaction) periodically and on shutdown, and reseed the live registry from the log at startup. Live gauges (online counts) stay re-derived, not stored.
This commit is contained in:
parent
fd455922a5
commit
8a9b6a37ca
10 changed files with 85 additions and 10 deletions
|
|
@ -349,6 +349,11 @@ impl Network {
|
|||
&self.stats
|
||||
}
|
||||
|
||||
// Seed the counters from persisted state at startup, so they survive restarts.
|
||||
pub fn seed_stats(&mut self, stats: BTreeMap<String, u64>) {
|
||||
self.stats = stats;
|
||||
}
|
||||
|
||||
// BOTSTATS view: (total lines, top talkers by count, descending).
|
||||
pub fn channel_activity(&self, channel: &str) -> Option<(u64, Vec<(String, u64)>)> {
|
||||
let c = self.channels.get(&lc(channel))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue