Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MaxRetry for MinIO operations #1530

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions minio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ type Config struct {
// Optional. Default is false
Reset bool

// The maximum number of times requests that encounter retryable failures should be attempted.
// Optional. Default is 10, same as the MinIO client.
MaxRetry int
ReneWerner87 marked this conversation as resolved.
Show resolved Hide resolved

// Credentials Minio access key and Minio secret key.
// Need to be defined
Credentials Credentials
Expand Down Expand Up @@ -124,6 +128,7 @@ var ConfigDefault = Config{
Token: "",
Secure: false,
Reset: false,

Credentials: Credentials{},
GetObjectOptions: minio.GetObjectOptions{},
PutObjectOptions: minio.PutObjectOptions{},
Expand Down
5 changes: 5 additions & 0 deletions minio/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type Config struct {
// Optional. Default is false
Reset bool

// The maximum number of times requests that encounter retryable failures should be attempted.
// Optional. Default is 10, same as the MinIO client.
MaxRetry int

// Credentials Minio access key and Minio secret key.
// Need to be defined
Credentials Credentials
Expand Down Expand Up @@ -62,6 +66,7 @@ var ConfigDefault = Config{
Token: "",
Secure: false,
Reset: false,
MaxRetry: minio.MaxRetry,
Credentials: Credentials{},
GetObjectOptions: minio.GetObjectOptions{},
PutObjectOptions: minio.PutObjectOptions{},
Expand Down
3 changes: 3 additions & 0 deletions minio/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func New(config ...Config) *Storage {
// Set default config
cfg := configDefault(config...)

// Set MaxRetry
minio.MaxRetry = cfg.MaxRetry

itpey marked this conversation as resolved.
Show resolved Hide resolved
// Minio instance
minioClient, err := minio.New(cfg.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(cfg.Credentials.AccessKeyID, cfg.Credentials.SecretAccessKey, cfg.Token),
Expand Down