How does Giraffe deal with request cancellation? #520
Answered
by
baronfel
xperiandri
asked this question in
Q&A
|
How is it aligned with the article https://andrewlock.net/using-cancellationtokens-in-asp-net-core-minimal-apis/ ? |
Answered by
baronfel
Aug 24, 2022
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 |
2 replies
Answer selected by
xperiandri
|
The proposed Async.WithCancellation in fsharp/fslang-suggestions#685 helped me solve request cancellation, maybe it helps somebody else... |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That article talks about using HttpContext.RequestAborted as the CancellationTokenSource for your requests - this still works. If you're using
tasks, 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 thecancellationTokenparameter of anAsync.StartAsTaskcall. Either way, it mostly just works out of the box as you'd expect!