Method WaitForFolderChangeAsync
- Namespace
- MailFathom.Application.Synchronization.Sessions
- Assembly
- MailFathom.Application.dll
WaitForFolderChangeAsync(TimeSpan, CancellationToken)
Waits until one of the watched folders changes or until the supplied wait elapses.
Task<MailboxFolderSetNotificationOutcome> WaitForFolderChangeAsync(TimeSpan maxWait, CancellationToken cancellationToken)
Parameters
maxWaitTimeSpanHow long this call may wait before it returns having observed nothing.
cancellationTokenCancellationTokenEnds the wait promptly and leaves the session usable.
Returns
- Task<MailboxFolderSetNotificationOutcome>
The folder the server named, or the statement that the wait ended without one.
Remarks
The bound belongs to the caller for the reason it does on the single-folder session: a push mechanism has to be re-issued before the server's own idle timeout, and an elapsed wait is how the session says it is ready to be renewed. An implementation treats that as an ordinary return and leaves the session usable.
Cancellation ends the wait as WaitElapsed rather than as an OperationCanceledException, and the session stays open.
Only the first folder to change is reported, because the pass that follows covers the whole account and there is nothing for a caller to do with the second name.
Exceptions
- ArgumentOutOfRangeException
Thrown when
maxWaitis negative or zero.- MailboxUnavailableException
Thrown when the mail server did not hold the session up within its configured resilience budget.
- MailboxFolderRecreatedException
Thrown when a re-established connection reselected its folder with a different UIDVALIDITY.