I have an async endpoint in WebAPI .Net Core such:
[HttpGet]
public async Task<ActionResult<List<Product>>> GetProduct()
{
await Task.Delay(10000);
return await Task.FromResult(Ok(Products));
}
As far as I read, using async will make to reuse threads instead of blocking them. When I fire 2 separated requests from the browser my expectation is that both end simultaneously however the second one takes 20 seconds instead 10.
Is my understanding of async wrong or did I just used the wrong code sample?
[Update] The issue was trying to trigger the requests from the same browser as pointed by the post answered in the comment section.