Table of Contents

Class MailRuleEvaluationRunRequests

Namespace
MailFathom.Application.Rules.Evaluation
Assembly
MailFathom.Application.dll

Takes a request to run an account's rules over its whole mailbox, and answers one that is already under way.

public sealed class MailRuleEvaluationRunRequests
Inheritance
MailRuleEvaluationRunRequests
Inherited Members

Remarks

The request is recorded and nothing is evaluated here. Running the rules is a step of the account's synchronization run, so what this writes is the statement that the run is wanted; the request thread neither performs the work nor keeps it alive, which is what stops an operator's terminal closing from cancelling a walk of their mailbox.

A second request while one is outstanding is answered with the run already in front of the account rather than refused or queued. Asking twice for the same thing is asking once: what the caller wanted is for the mail to be re-evaluated, and it is going to be.

The one place the two kinds of request differ is what they do to a run they find. A schedule finding any run outstanding stands down, because the walk it wanted is under way. An operator finding a scheduled run outstanding replaces it, because what they asked for reaches every rule the account has while the scheduled walk reaches only the rules that opted into a schedule — answering the wider request with the narrower run would tell somebody their whole rule set had been applied when part of it never was. The replacement walks the mailbox from the beginning and reaches everything the scheduled run had reached, and the schedule's next occasion starts a run of its own.

Constructors

MailRuleEvaluationRunRequests(IMailRuleEvaluationRunStore, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the request intake.

Methods

SubmitAsync(MailAccountId, CancellationToken)

Asks for the account's rules to be run over every message stored for it.

SubmitScheduledAsync(MailAccountId, CancellationToken)

Asks, on a rule's own declared occasion, for the account's scheduled rules to be run over its mailbox.