Table of Contents

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

id DiscoveryRunId

The run the caller is stopping.

user UserId

The user the caller was admitted for.

now DateTimeOffset

The instant the stop was asked for.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<bool>

true when the run was this user's and had not been forgotten; false otherwise.

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.