From: Robin Appelman Date: Mon, 4 Dec 2017 15:34:53 +0000 (+0100) Subject: add retry wrapper when reading files from swift X-Git-Tag: v12.0.5RC1~35^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0519ca589381b2473fa23a135efb185f29c71649;p=nextcloud-server.git add retry wrapper when reading files from swift Signed-off-by: Robin Appelman --- diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index d32d6b3a19c..ff6b1e6271b 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -39,6 +39,7 @@ use Guzzle\Http\Url; use Guzzle\Http\Exception\ClientErrorResponseException; use Icewind\Streams\CallbackWrapper; use Icewind\Streams\IteratorDirectory; +use Icewind\Streams\RetryWrapper; use OpenCloud; use OpenCloud\Common\Exceptions; use OpenCloud\OpenStack; @@ -385,7 +386,7 @@ class Swift extends \OC\Files\Storage\Common { stream_context_set_option($stream, 'swift','content', $streamInterface); if(!strrpos($streamInterface ->getMetaData('wrapper_data')[0], '404 Not Found')) { - return $stream; + return RetryWrapper::wrap($stream); } return false; } catch (\Guzzle\Http\Exception\BadResponseException $e) { diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php index 36a1a4a873f..725ed7fcaf3 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -25,6 +25,7 @@ namespace OC\Files\ObjectStore; use Guzzle\Http\Exception\ClientErrorResponseException; +use Icewind\Streams\RetryWrapper; use OCP\Files\ObjectStore\IObjectStore; use OCP\Files\StorageAuthException; use OCP\Files\StorageNotAvailableException; @@ -263,7 +264,7 @@ class Swift implements IObjectStore { // save the object content in the context of the stream to prevent it being gc'd until the stream is closed stream_context_set_option($stream, 'swift', 'content', $objectContent); - return $stream; + RetryWrapper::wrap($stream); } /**