title: How do you deal with rejected responses in guzzel?
body: <p>Consider the following code:</p>
  
  <pre><code>public function getItemHistoryForRegion(array $items, array $regions) {
  
      $client            = new Client(['expect' =&gt; false]);
      $acceptedResponses = [];
      $rejectedResponses = [];
      $createdRequests   = [];
      $regionAndItem     = [];
  
      foreach($items as $item) {
          foreach ($regions as $region) {
              array_push($regionAndItem, [$item, $region]);
              array_push($createdRequests, new Request('GET', 'https://public-crest.eveonline.com/market/'.$region.'/types/'.$item.'/history/'));
          }
      }
  
      $pool = new Pool($client, $createdRequests, [
          'concurrency' =&gt; 10,
          'fulfilled'   =&gt; function ($response, $index) use (&amp;$acceptedResponses) {
              EveLogHandler::requestLog($response, 'eve_online_region_item_history_responses.log');
              $acceptedResponses[$index] = json_decode($response-&gt;getBody()-&gt;getContents());
          },
          'rejected'    =&gt; function ($reason, $index) use(&amp;$rejectedResponses)  {
              EveLogHandler::messageLog($reason, 'eve_online_region_item_history_rejected_responses.log');
          },
      ]);
  
      $promise = $pool-&gt;promise();
      $promise-&gt;wait();
  
      $historyDetails = new HistoryDetails($acceptedResponses, $regionAndItem);
      $historyDetails-&gt;createHistoryDetails();
  
      return $historyDetails-&gt;getHistoryDetails();
  }
  </code></pre>
  
  <p>I create a an array of requests that are then pooled. There are generally 10,000 requests that come through here.</p>
  
  <p>One of the issues is the rejected section:</p>
  
  <pre><code>'rejected'    =&gt; function ($reason, $index) use(&amp;$rejectedResponses)  {
                  EveLogHandler::messageLog($reason, 'eve_online_region_item_history_rejected_responses.log');
  },
  </code></pre>
  
  <p>Here I just log out the rejected message and it comes back as:</p>
  
  <pre><code>[2016-01-27 16:35:00] production.INFO: Message ["[object] (GuzzleHttp\\Exception\\ConnectException(code: 0): cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at /home/ccccc/test_site/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186)"] []
  [2016-01-27 16:35:57] production.INFO: Message ["[object] (GuzzleHttp\\Exception\\ConnectException(code: 0): cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at /home/ccccc/test_site/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186)"] []
  </code></pre>
  
  <p>Theres a ton of these as there are probably well over 13 jobs that get queued that each send 10,000 requests each, as you can see I pool them so I do 10 at a time.</p>
  
  <p>The rate limit for this api is 150 requests per second. So I know I am not hitting a 150 or at least I shouldn't be.</p>
  
  <p><strong>The question I have for you is how do I re-try the rejected request? Is there a way to say, on fail retry a max of x times? Does guzzle have that built in?</strong></p>