Make sure total_time_us from curl progress is set
parent
370e082b4a
commit
a5d79db0a7
|
@ -305,7 +305,7 @@ class CurlDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
$exception = new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
|
$exception = new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
|
||||||
$exception->setTotalResponseTime($progress['total_time_us']);
|
$exception->setTotalResponseTime(isset($progress['total_time_us']) ? $progress['total_time_us'] : null);
|
||||||
throw $exception;
|
throw $exception;
|
||||||
}
|
}
|
||||||
$statusCode = $progress['http_code'];
|
$statusCode = $progress['http_code'];
|
||||||
|
@ -325,13 +325,13 @@ class CurlDownloader
|
||||||
$contents = stream_get_contents($job['bodyHandle']);
|
$contents = stream_get_contents($job['bodyHandle']);
|
||||||
}
|
}
|
||||||
$response = new Response(array('url' => $progress['url']), $statusCode, $headers, $contents);
|
$response = new Response(array('url' => $progress['url']), $statusCode, $headers, $contents);
|
||||||
$response->setTotalResponseTime($progress['total_time_us']);
|
$response->setTotalResponseTime(isset($progress['total_time_us']) ? $progress['total_time_us'] : null);
|
||||||
$this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
|
$this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
|
||||||
} else {
|
} else {
|
||||||
rewind($job['bodyHandle']);
|
rewind($job['bodyHandle']);
|
||||||
$contents = stream_get_contents($job['bodyHandle']);
|
$contents = stream_get_contents($job['bodyHandle']);
|
||||||
$response = new Response(array('url' => $progress['url']), $statusCode, $headers, $contents);
|
$response = new Response(array('url' => $progress['url']), $statusCode, $headers, $contents);
|
||||||
$response->setTotalResponseTime($progress['total_time_us']);
|
$response->setTotalResponseTime(isset($progress['total_time_us']) ? $progress['total_time_us'] : null);
|
||||||
$this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
|
$this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
|
||||||
}
|
}
|
||||||
fclose($job['bodyHandle']);
|
fclose($job['bodyHandle']);
|
||||||
|
|
Loading…
Reference in New Issue