Skip to main content

alert_admins

Function alert_admins 

Source
pub async fn alert_admins(pool: &PgPool) -> AppResult<u64>
Expand description

Tells the active administrators about each group that has newly lost its last present manager, once per gap: the group is marked (projects.manager_gap_alerted_at) and the mark is cleared when the group has a present manager again, so a later gap is reported anew. Returns the number of groups reported. Run by the hourly housekeeping.

§Invariants

  • Permission: none – a server task.
  • Locks: the group row (FOR UPDATE) while it is checked again and marked, so two servers do not both report it.
  • Audit: project.manager_gap_alert per group reported.
  • Notifications: an access_alert to every active administrator (not mutable); webhooks: none.
  • Atomic: one transaction per group.