Table of Contents

Class ReminderSweep

Namespace
MailFathom.Application.Reminders
Assembly
MailFathom.Application.dll

Announces the reminders that have come due, of every kind, one bounded pass at a time.

public sealed class ReminderSweep
Inheritance
ReminderSweep
Inherited Members

Remarks

A reminder is due whether or not anybody has a client open, which is the whole reason the producer is here rather than in a screen: what raises it is this pass writing a notification record, and every client — the one that was open, the one opened an hour later, and the second machine — learns about it the way it learns about everything else.

One producer for every kind of reminder rather than one per kind. A calendar event and a task's due date are different records with different anchors, and nothing else about announcing them differs: the ordering that makes it exactly once, the bound on a pass, the window that keeps a long outage quiet, and the lease are one decision each. So each kind contributes an IReminderSchedule that knows its own table, and this pass reads every one of them registered.

The pass is one run for the whole deployment, so it runs only under the lease on its own scope, as ADR 0031 decides. A replica refused the lease announces nothing and asks again on its next interval. The scope is the reminders' rather than the calendar's, so a rolling upgrade past the build that renamed it has one replica holding each — which announces nothing twice, because the claim is conditional on the instant and the deduplication key names the reminder.

Exactly once, from two rules rather than one. The notification is written first and the claim recorded after it, so a pass that ends between them announces nothing twice — the record's own deduplication key names the reminder and the instant it falls at, so the repeat is folded into the statement already standing unread while a reminder that has become due at a new instant is a condition of its own and is said — and loses nothing either, because the reminder is still unclaimed and the next pass reaches it. What the claim is made against is that same instant, which is what makes a record moved forward due again at its new time and one moved back onto an announced time stay quiet.

Nothing long overdue is announced. A deployment that was off for a day comes back to reminders nobody could have acted on, about things that have already happened, and delivering them would be a burst of statements in place of the one thing somebody wanted to be told. LongestLateAnnouncement is how late is still worth saying; anything older is left where it is and announced by nothing.

Constructors

ReminderSweep(AccessAuthorization, IEnumerable<IReminderSchedule>, NotificationRaiser, IWorkLeaseRunner, TimeProvider)

Initializes the pass.

Fields

LongestLateAnnouncement

How late a reminder may still be announced, past which it is passed over in silence.

MaximumRemindersPerRun

How many reminders one pass announces at most, per kind of thing that carries them.

Methods

RunAsync(CancellationToken)

Runs one bounded pass if this replica takes the pass's lease.