Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(objectstore): add configurable S3 retry attempts
Add retriesMaxAttempts parameter to S3 objectstore configuration
to allow customization of AWS SDK retry behavior for handling
unreliable network conditions or proxy issues.

Defaults to 5 retries (AWS SDK default) if not specified.

Signed-off-by: nfebe <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
nfebe authored and kesselb committed Dec 3, 2025
commit 8d5dcbce798f5e61402ff33a132a6c3f01f1b5a8
19 changes: 19 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,25 @@
],
],

/**
* To use S3 object storage
*/
'objectstore' => [
'class' => 'OC\\Files\\ObjectStore\\S3',
'arguments' => [
'bucket' => 'nextcloud',
'key' => 'your-access-key',
'secret' => 'your-secret-key',
'hostname' => 's3.example.com',
'port' => 443,
'use_ssl' => true,
'region' => 'us-east-1',
// optional: Maximum number of retry attempts for failed S3 requests
// Default: 5
'retriesMaxAttempts' => 5,
],
],

/**
* If this is set to true and a multibucket object store is configured then
* newly created previews are put into 256 dedicated buckets.
Expand Down
2 changes: 2 additions & 0 deletions lib/private/Files/ObjectStore/S3ConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ trait S3ConfigTrait {
private int|float $copySizeLimit;

private bool $useMultipartCopy = true;

protected int $retriesMaxAttempts;
}
3 changes: 2 additions & 1 deletion lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ protected function parseParams($params) {
$this->putSizeLimit = $params['putSizeLimit'] ?? 104857600;
$this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000;
$this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true);
$this->retriesMaxAttempts = $params['retriesMaxAttempts'] ?? 5;
$params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
$params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
$params['s3-accelerate'] = $params['hostname'] === 's3-accelerate.amazonaws.com' || $params['hostname'] === 's3-accelerate.dualstack.amazonaws.com';
Expand Down Expand Up @@ -114,7 +115,7 @@ public function getConnection() {
'use_aws_shared_config_files' => false,
'retries' => [
'mode' => 'standard',
'max_attempts' => 5,
'max_attempts' => $this->retriesMaxAttempts,
],
];

Expand Down
Loading