Add lazy inactivity-expiry for accounts and channels
Accounts and channels now carry a last-activity stamp and are dropped once inactive past a configured threshold. A login stamps the account, a join stamps the channel — both coalesced to at most one log entry per day so routine traffic doesn't bloat the log, and stamps replicate so activity on any node keeps a record alive network-wide. Expiry is lazy in the proven style: a periodic pass computes it from the stored stamps with no per-record timer, reusing the same relation the vhost and suspension expiries use. The sweep spares operator accounts, accounts with a live session, occupied channels, and anything an operator has pinned with the new NOEXPIRE command (NickServ NOEXPIRE <account>, ChanServ NOEXPIRE <#channel>, both Priv::Admin). Each expiry is announced to the audit channel and clears the channel's +r. Configured under [expire] (accounts_days / channels_days); a zero or omitted field leaves that kind never expiring, and omitting the section disables expiry entirely.
This commit is contained in:
parent
698d604954
commit
253d4c2a2d
11 changed files with 413 additions and 13 deletions
|
|
@ -160,7 +160,11 @@ fn to_wire(entry: &LogEntry) -> Option<ReplicationEvent> {
|
|||
| Event::VhostOfferRemoved { .. }
|
||||
| Event::VhostForbidAdded { .. }
|
||||
| Event::VhostForbidRemoved { .. }
|
||||
| Event::VhostTemplateSet { .. } => return None,
|
||||
| Event::VhostTemplateSet { .. }
|
||||
| Event::AccountSeen { .. }
|
||||
| Event::ChannelUsed { .. }
|
||||
| Event::AccountNoExpire { .. }
|
||||
| Event::ChannelNoExpire { .. } => return None,
|
||||
};
|
||||
Some(ReplicationEvent { origin: entry.origin().to_string(), seq: entry.seq(), lamport: entry.lamport(), kind: Some(kind) })
|
||||
}
|
||||
|
|
@ -417,6 +421,8 @@ mod tests {
|
|||
greet: String::new(),
|
||||
vhost: None,
|
||||
vhost_request: None,
|
||||
last_seen: 111,
|
||||
noexpire: false,
|
||||
};
|
||||
let registered = LogEntry::for_test("A", 0, 1, Event::AccountRegistered(Box::new(acct)));
|
||||
let wire = to_wire(®istered).expect("account registration replicates");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue