Method TryRequestStopAsync
- Namespace
- MailFathom.Application.Discovery.Streaming
- Assembly
- MailFathom.Application.dll
TryRequestStopAsync(DiscoveryRunId, UserId, DateTimeOffset, CancellationToken)
Records that a run this user started has been asked to stop, so it composes nothing further.
Task<bool> TryRequestStopAsync(DiscoveryRunId id, UserId user, DateTimeOffset now, CancellationToken cancellationToken)
Parameters
idDiscoveryRunIdThe run the caller is stopping.
userUserIdThe user the caller was admitted for.
nowDateTimeOffsetThe instant the stop was asked for.
cancellationTokenCancellationTokenCancels the write.
Returns
Remarks
It records the request rather than writing the ending, because what a run spent is the executing replica's ledger to report and an ending composed anywhere else would carry a cost figure of nothing. The next event that replica tries to write is refused, which is how the request reaches it however it is routed, and the ending it then writes carries the true counts.
A run that has already ended is reported as found and nothing is recorded, because whoever asked could not have known it finished a moment earlier — and reporting that as a failure would make a control that worked look broken.