Closed alexeymarkov closed 4 years ago
Posting guidance over from #106
Regarding CancellationToken pay attention there are two of them : one injected into a function and another one from HttpContext.RequestAborted. If you cancel a http request only the second is triggered which makes the first useless IMHO. Maybe combining them into a single could be a solution (for http and for signalr triggers). Have a look at CancellationTokenSource.CreateLinkedTokenSource.
Resolved, a combined source has been used for http based triggers. Will push out in beta2 today.
Not sure if I'm missing something, but ICommandHandler<TCommand, TResult>.ExecuteAsync
doesn't have a CancellationToken
argument? Is there some other way to get a ct my handlers can use?
(I'm on 4.0.56-beta.4
)
Use ICancellableCommandHandler instead of ICommandHandler
It has Task
@alexeymarkov ah, excellent, thanks!
Hi James,
It is automatically injected into a function. Please pass it to DispatchAsync. For token validation and for other "awaitable" methods I would also make sense to pass a CancellationToken. Thanx!
Regards, Alexey