How does Giraffe deal with request cancellation? #520
-
How is it aligned with the article https://andrewlock.net/using-cancellationtokens-in-asp-net-core-minimal-apis/ ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
That article talks about using HttpContext.RequestAborted as the CancellationTokenSource for your requests - this still works. If you're using |
Beta Was this translation helpful? Give feedback.
-
The proposed Async.WithCancellation in fsharp/fslang-suggestions#685 helped me solve request cancellation, maybe it helps somebody else... |
Beta Was this translation helpful? Give feedback.
That article talks about using HttpContext.RequestAborted as the CancellationTokenSource for your requests - this still works. If you're using
task
s, you'll need to check it yourself, and/or propagate it to your called methods. If you're using Asyncs, you can use HttpContext.RequestAborted as thecancellationToken
parameter of anAsync.StartAsTask
call. Either way, it mostly just works out of the box as you'd expect!