Skip to content
Open
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
48 changes: 47 additions & 1 deletion origin/blobserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -23,11 +23,57 @@ import (
type Config struct {
Listener listener.Config `yaml:"listener"`
DuplicateWriteBackStagger time.Duration `yaml:"duplicate_write_back_stagger"`

// Timeout configurations
DownloadTimeout time.Duration `yaml:"download_timeout"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding the custom timeout configuration?

UploadTimeout time.Duration `yaml:"upload_timeout"`
ReplicationTimeout time.Duration `yaml:"replication_timeout"`
BackendTimeout time.Duration `yaml:"backend_timeout"`
ReadinessTimeout time.Duration `yaml:"readiness_timeout"`

// Limit configurations
MaxConcurrentDownloads int `yaml:"max_concurrent_downloads"`
MaxConcurrentUploads int `yaml:"max_concurrent_uploads"`

// Retry configurations
MaxRetries int `yaml:"max_retries"`
RetryDelay time.Duration `yaml:"retry_delay"`
RetryMaxDelay time.Duration `yaml:"retry_max_delay"`
}

func (c Config) applyDefaults() Config {
if c.DuplicateWriteBackStagger == 0 {
c.DuplicateWriteBackStagger = 30 * time.Minute
}
if c.DownloadTimeout == 0 {
c.DownloadTimeout = 5 * time.Minute
}
if c.UploadTimeout == 0 {
c.UploadTimeout = 10 * time.Minute
}
if c.ReplicationTimeout == 0 {
c.ReplicationTimeout = 5 * time.Minute
}
if c.BackendTimeout == 0 {
c.BackendTimeout = 2 * time.Minute
}
if c.ReadinessTimeout == 0 {
c.ReadinessTimeout = 30 * time.Second
}
if c.MaxConcurrentDownloads == 0 {
c.MaxConcurrentDownloads = 20
}
if c.MaxConcurrentUploads == 0 {
c.MaxConcurrentUploads = 10
}
if c.MaxRetries == 0 {
c.MaxRetries = 3
}
if c.RetryDelay == 0 {
c.RetryDelay = 100 * time.Millisecond
}
if c.RetryMaxDelay == 0 {
c.RetryMaxDelay = 5 * time.Second
}
return c
}
Loading
Loading