Merge pull request #21409 from nextcloud/backport/21317/stable19

[stable19] Upload part size as S3 parameter instead of constant value
This commit is contained in:
Roeland Jago Douma 2020-06-15 16:30:22 +02:00 committed by GitHub
commit 08a03b65ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -48,6 +48,9 @@ trait S3ConnectionTrait {
/** @var int */
protected $timeout;
/** @var int */
protected $uploadPartSize;
protected $test;
protected function parseParams($params) {
@ -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'] === '') {

View File

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