title: Multiple HTTP requests trigger HTTP Client timeout
body: <p>I have an app that's sending 500 HTTP requests asynchronously.  All requests processed <em>after</em> 15 seconds fail because of the timeout on the HTTP Client, <em>even</em> when the requested endpoint already returned a 200 OK. </p>
  
  <p>The code is very straight-forward. Here we take a chunk of requests (500), and execute them asynchronously. It should be noted that the function below is an Azure function running on the consumption-based plan. </p>
  
  <pre><code>    public async Task RunBatch(List&lt;Request&gt; requests)
      {
          if (requests != null &amp;&amp; requests .Count &gt; 0)
          {
              var tasks = new Task[requests.Count];
              var i = 0;
              foreach (var request in requests)
              {
                  var request = new HttpRequestMessage(HttpMethod.Post, new Uri(request.Url));
                  request.Content = new StringContent(request.BodyString, Encoding.UTF8, "application/json");
                  tasks[i] = _httpClient.SendAsync(request);
                  i++;
              }
  
              await Task.WhenAll(tasks);
          }
      }
  </code></pre>
  
  <p>The following code exists in my constructor</p>
  
  <pre><code>_httpClient = new HttpClient();
  _httpClient.Timeout = new TimeSpan(0, 0, 15); // 15 seconds
  </code></pre>
  
  <p>Here are logs from Azure.</p>
  
  <p><a href="https://i.stack.imgur.com/vqa2I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vqa2I.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/gLq86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gLq86.png" alt="enter image description here"></a></p>
  
  <p>I'd like each request to have a timeout of 15 seconds. However, I need it to give me an accurate response code whenever my server gets around to processing the awaited request. Is this possible?</p>
  
  <p>I should note: with a higher Http timeout (1 min), all requests succeed.</p>