Merge pull request #7409 from nextcloud/swift-retry-12

[12]add retry wrapper when reading files from swift
This commit is contained in:
Roeland Jago Douma 2017-12-08 09:26:41 +01:00 committed by GitHub
commit ac29608db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
}
/**