pub async fn run_once(pool: &PgPool, period_hours: u64) -> AppResult<u64>Expand description
Queues the digests that are due (every period_hours; 0 = never).
Returns how many were queued.
ยงInvariants
- Permission: none; a background task, not an actor. Only active editors and administrators with e-mail on, the kind not muted, who are members of an active group with new requests.
- Locks: the digest row of the user and group (
FOR UPDATE), so an overlapping run (or another server) finds the period covered. - Data: the digest lists only requests the user may read; the covered period moves on even when no digest text results.
- Audit: none.
- Notifications: one
request_digestnotification per due user and group, e-mail queued; webhooks: none. - Atomic: one transaction per user and group
(
tests/request_digests.rs).