diff options
author | Robin Appelman <robin@icewind.nl> | 2017-12-04 16:34:53 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-12-04 16:34:53 +0100 |
commit | 046eb0c635cbfe3ceb21da8f13a2159ec12264e1 (patch) | |
tree | cf1b59ff3b233fe8ecb547dc7b5804dfa5f6cecb | |
parent | 567757c793faed6925a538571a9e4f5b8b396bfd (diff) | |
download | nextcloud-server-046eb0c635cbfe3ceb21da8f13a2159ec12264e1.tar.gz nextcloud-server-046eb0c635cbfe3ceb21da8f13a2159ec12264e1.zip |
add retry wrapper when reading files from swift
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Swift.php | 3 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/Swift.php | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 970ade02cea..f07087e903d 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -43,6 +43,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; @@ -389,7 +390,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 2ee3a2d62d3..ecfbe136e4c 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -26,6 +26,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; @@ -264,7 +265,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); } /** |