Method DrainAsync
- Namespace
- MailFathom.Application.Synchronization.Drain
- Assembly
- MailFathom.Application.dll
DrainAsync(MailAccountId, CancellationToken)
Takes one bounded pass over what a held account's source still holds.
public Task<MailboxDrainReport> DrainAsync(MailAccountId account, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account whose source is drained.
cancellationTokenCancellationTokenCancels the pass; a batch already issued is cancelled with it.
Returns
- Task<MailboxDrainReport>
What the pass did, which is Nothing for an account whose mailbox is not held.
Remarks
An account whose configuration has come to synchronize a folder playing a virtual role has its drain paused rather than run: such a folder presents messages that are occurrences of other folders, so draining it would remove mail from folders nobody asked about. The pause is silent in the counts and visible in the standing figures, which go on saying what the source still holds. Withdrawing that mapping lifts the pause and leaves the rows it stored standing, so both halves of the pass name the folders they may reach as well, rather than resting on the pause alone.
The two halves share one budget, so MaxDrainedEmailsPerRun bounds what a run takes off the source rather
than bounding each half of it. The erased copies are spent first because that half is an erasure finishing
rather than a mailbox emptying: a message somebody asked to be rid of is still on the source until this pass
reaches it, and letting a mailbox of years starve it would leave that for as long as the drain takes.
Exceptions
- OperationCanceledException
Thrown when the caller cancels the pass.