Commit da98f0ea authored by Keven's avatar Keven
Browse files

Fixed timeout on upload

parent 5dff6bec
......@@ -89,14 +89,19 @@ class SendFile extends FileCommand
/**
*
* @param string $baseUrl
* @param \Libcast\Client\Http\CurlCLient $client
* @param \Libcast\Client\Http\CurlClient $client
* @param SerializerInterface $serializer
* @return string
*/
public function execute($baseUrl, $client, SerializerInterface $serializer)
{
if (!$this->mustBeChunked()) {
return parent::execute($baseUrl, $client, $serializer);
$timeout = $client->getTimeout();
$client->setTimeout(0);
$response = parent::execute($baseUrl, $client, $serializer);
$client->setTimeout($timeout);
return $response;
}
$path = $this->requestOptions[CURLOPT_POSTFIELDS]['path'];
......@@ -106,6 +111,9 @@ class SendFile extends FileCommand
$this->prepare($baseUrl);
$timeout = $client->getTimeout();
$client->setTimeout(0);
$this->requestOptions[CURLOPT_POSTFIELDS]['chunks'] = count($chunks);
$chunk = 0;
foreach ($chunks as $chunkPath) {
......@@ -115,6 +123,8 @@ class SendFile extends FileCommand
unlink($chunkPath);
}
$client->setTimeout($timeout);
return $this->process($response, $serializer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment