Skip to content

Commit

Permalink
Altered log format
Browse files Browse the repository at this point in the history
  • Loading branch information
jenwachter committed Sep 26, 2017
1 parent 938e06e commit fb376f2
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/HttpExchange/Adapters/Guzzle6.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,26 @@ public function createAsynsRequest($method, $url, $params = null, $header = null
public function batch($requests)
{
$tries = 0;
$logs = array();
$this->response = array();

do {

$tries++;

$logs[$tries] = array();

if ($tries > 1) {
// wait a couple seconds between first and second request
// $this->logger->addInfo("sleep for a sec");
sleep(2);

// reset logs -- let's only log the second try
$logs = array();
}

// $this->logger->addInfo("Attempt #{$tries}; " . count($requests) . " requests.");

// start output buffering
if ($this->debug) ob_start();

// make requests
$response = \GuzzleHttp\Promise\settle($requests)->wait();

// end output buffering
if ($this->debug) ob_end_clean();

// save debug data if debug is on
$debug = $this->debug ? ob_get_contents() : null;

// analyze response and keep track of failed requests this loop
$failed = array();

Expand All @@ -115,12 +106,7 @@ public function batch($requests)
"url" => $_SERVER["REQUEST_URI"]
);

if ($this->debug) {
// add debug data
$log["debug"] = $debug;
}

$logs[] = $log;
$logs[$tries][] = $log;
}
}

Expand Down

0 comments on commit fb376f2

Please sign in to comment.