Method OnCanceled
OnCanceled(TState, IReadOnlyList<AsyncQueuedItem<TInput>>, IReadOnlyList<AsyncTrackedItem<TInput>>)
Gives the tracked items to start because a cancellation ended one item or more. There is no publish decision here: a canceled item sends nothing to the results and nothing to the errors. A cancellation is always an expected end with no message. Its source is external code, a strategy that replaces its own previous run, or a Queued item that a cancellation removes before its turn.
The engine calls this one time for the cancellations of one transaction. One send of a cancellation stream can end each Queued item and each Running item whose operation observes its token, all at one instant. One call gives one decision over the queue that holds no item of those ends. Thus, a strategy does not start an item that is about to end.
A strategy that holds a reference to its current run clears that reference here. Otherwise, the last value stays in memory after the pipeline becomes empty.
protected abstract IReadOnlyList<AsyncMapBase.AsyncToStart<TInput>> OnCanceled(TState state, IReadOnlyList<AsyncMapBase.AsyncQueuedItem<TInput>> canceled, IReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>> tracked)
Parameters
stateTStateThe scheduling state of this MapAsync call.
canceledIReadOnlyList<AsyncMapBase.AsyncQueuedItem<TInput>>Each item that a cancellation ended now, in the sequence of their admissions. Each one is the instance that this strategy got in Admit(TState, AsyncQueuedItem<TInput>, IReadOnlyList<AsyncTrackedItem<TInput>>).
trackedIReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>>The queue of this pipeline, in the sequence of the admissions. It holds no item of
canceled: the pipeline removes each of those before this call. The other rules of the OnCompleted(TState, AsyncQueuedItem<TInput>, AsyncCompletion, IReadOnlyList<AsyncTrackedItem<TInput>>) list hold here also.
Returns
- IReadOnlyList<AsyncMapBase.AsyncToStart<TInput>>
Tracked items to start now, or to promote now. Give None for no items.