1
0
Fork 0

Make sure total_time_us from curl progress is set

pull/9592/head
Wissem Riahi 2021-01-06 18:00:48 +01:00
parent 370e082b4a
commit a5d79db0a7
1 changed files with 3 additions and 3 deletions

View File

@ -305,7 +305,7 @@ class CurlDownloader
}
$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;
}
$statusCode = $progress['http_code'];
@ -325,13 +325,13 @@ class CurlDownloader
$contents = stream_get_contents($job['bodyHandle']);
}
$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);
} else {
rewind($job['bodyHandle']);
$contents = stream_get_contents($job['bodyHandle']);
$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);
}
fclose($job['bodyHandle']);