fix: add deadlines for all synchronous REST callers (#19741)

add deadlines that can be dynamically changed via
the drive max timeout values.

Bonus: optimize "file not found" case and hung drives/network - circuit break the check and return right
away instead of waiting.
This commit is contained in:
Harshavardhana
2024-05-15 09:52:29 -07:00
committed by GitHub
parent c05ca63158
commit d3db7d31a3
6 changed files with 56 additions and 17 deletions

View File

@@ -25,6 +25,10 @@ import (
"github.com/minio/pkg/v2/env"
)
const (
envMaxDriveTimeout = "MINIO_DRIVE_MAX_TIMEOUT"
)
// DefaultKVS - default KVS for drive
var DefaultKVS = config.KVS{
config.KV{
@@ -65,8 +69,9 @@ func LookupConfig(kvs config.KVS) (cfg Config, err error) {
if err = config.CheckValidKeys(config.DriveSubSys, kvs, DefaultKVS); err != nil {
return cfg, err
}
// if not set. Get default value from environment
d := kvs.GetWithDefault(MaxTimeout, DefaultKVS)
d := env.Get(envMaxDriveTimeout, kvs.GetWithDefault(MaxTimeout, DefaultKVS))
if d == "" {
d = env.Get("_MINIO_DRIVE_MAX_TIMEOUT", "")
if d == "" {