Wait for async function in synchronous context for X time until cancel
Hi!
How can i wait X time for this function to finish or otherwise throw/cancel/return something
This function comes from an outside library
Only things I see are with usage of await but i need this method to be synchronous
4 Replies
Polly's timeout might be a solution: https://github.com/App-vNext/Polly
I think I've figured it out without a library, the only problem I've encountered is lack of ability to lack my task since the library doesnt expose parameter for cancellation token
but it seems to be kinda ok i guess?
Since it's only a rest request (code from inside the method)
If it just performs an API call, just call it manually with HttpClient and you'll get cancellation token support
That makes sense. Thank you for your help ❤️