Browse Source
add retry wrapper when reading files from swift
Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/7387/head
Robin Appelman
8 years ago
No known key found for this signature in database
GPG Key ID: CBCA68FBAEBF98C9
2 changed files with
4 additions and
2 deletions
-
apps/files_external/lib/Lib/Storage/Swift.php
-
lib/private/Files/ObjectStore/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) { |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|