summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-06-09 19:28:58 +0200
committerGitHub <noreply@github.com>2020-06-09 19:28:58 +0200
commit8bee8e1317dd22abc3179508a73ea7b353ee5fc8 (patch)
tree708d750d15e0e5de8382d9c1c955a7d962f43193
parent892589746dd0f758358adbc66a1bd729a8374e55 (diff)
parent3594ba6971df3b070130f89e2b1f72ef5f9330bd (diff)
downloadnextcloud-server-8bee8e1317dd22abc3179508a73ea7b353ee5fc8.tar.gz
nextcloud-server-8bee8e1317dd22abc3179508a73ea7b353ee5fc8.zip
Merge pull request #21317 from FlorentCoppint/s3_upload_part_size
Upload part size as S3 parameter instead of constant value
-rw-r--r--lib/private/Files/ObjectStore/S3ConnectionTrait.php4
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
index 5a619182238..0208df1908a 100644
--- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php
+++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
@@ -47,6 +47,9 @@ trait S3ConnectionTrait {
/** @var int */
protected $timeout;
+
+ /** @var int */
+ protected $uploadPartSize;
protected $test;
@@ -60,6 +63,7 @@ trait S3ConnectionTrait {
$this->test = isset($params['test']);
$this->bucket = $params['bucket'];
$this->timeout = !isset($params['timeout']) ? 15 : $params['timeout'];
+ $this->uploadPartSize = !isset($params['uploadPartSize']) ? 524288000 : $params['uploadPartSize'];
$params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
$params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
if (!isset($params['port']) || $params['port'] === '') {
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index f749769cd09..d7c878178d2 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -33,8 +33,6 @@ use Aws\S3\S3Client;
use Icewind\Streams\CallbackWrapper;
use OC\Files\Stream\SeekableHttpStream;
-const S3_UPLOAD_PART_SIZE = 524288000; // 500MB
-
trait S3ObjectTrait {
/**
* Returns the connection
@@ -91,7 +89,7 @@ trait S3ObjectTrait {
$uploader = new MultipartUploader($this->getConnection(), $countStream, [
'bucket' => $this->bucket,
'key' => $urn,
- 'part_size' => S3_UPLOAD_PART_SIZE,
+ 'part_size' => $this->uploadPartSize,
]);
try {