Skip to content
Snippets Groups Projects
Unverified Commit 65141d48 authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

Allow config to specify the bucket exists


In the 99% case the bucket is just always there. And if it is not the
read/write will fail hard anyways. Esp on big instances the Objectstore
is not always fast and this can save a few hundered ms of each request
that acess the objectstore.

In short it is adding

'verify_bucket_exists' => false

To the S3 config part

Signed-off-by: default avatarRoeland Jago Douma <roeland@famdouma.nl>
parent 2c6bbe78
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,7 @@ trait S3ConnectionTrait { ...@@ -76,6 +76,7 @@ trait S3ConnectionTrait {
if (!isset($params['port']) || $params['port'] === '') { if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443; $params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443;
} }
$params['verify_bucket_exists'] = empty($params['verify_bucket_exists']) ? true : $params['verify_bucket_exists'];
$this->params = $params; $this->params = $params;
} }
...@@ -130,7 +131,7 @@ trait S3ConnectionTrait { ...@@ -130,7 +131,7 @@ trait S3ConnectionTrait {
['app' => 'objectstore']); ['app' => 'objectstore']);
} }
if (!$this->connection->doesBucketExist($this->bucket)) { if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
$logger = \OC::$server->getLogger(); $logger = \OC::$server->getLogger();
try { try {
$logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']); $logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment