mirror of
https://github.com/minio/minio.git
synced 2025-01-26 22:23:15 -05:00
use newDynamicTimeoutWithOpts() when appropriate (#16266)
This commit is contained in:
parent
988a2e8fed
commit
80fc3a8a52
@ -357,9 +357,11 @@ func initServer(ctx context.Context, newObject ObjectLayer) error {
|
|||||||
|
|
||||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
lockTimeout := newDynamicTimeout(5*time.Second, 3*time.Second)
|
lockTimeout := newDynamicTimeoutWithOpts(dynamicTimeoutOpts{
|
||||||
// do not retry to avoid high contention on startup.
|
timeout: 5 * time.Second,
|
||||||
lockTimeout.retryInterval = -1
|
minimum: 3 * time.Second,
|
||||||
|
retryInterval: -1, // do not retry to avoid high contention on startup.
|
||||||
|
})
|
||||||
|
|
||||||
// Do an initial random sleep to avoid stampeding herd of initial
|
// Do an initial random sleep to avoid stampeding herd of initial
|
||||||
// lock request. This will spread locks requests over 1 second.
|
// lock request. This will spread locks requests over 1 second.
|
||||||
|
@ -38,11 +38,11 @@ var lockRetryInterval time.Duration
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Check for MINIO_DSYNC_TRACE env variable, if set logging will be enabled for failed REST operations.
|
// Check for MINIO_DSYNC_TRACE env variable, if set logging will be enabled for failed REST operations.
|
||||||
dsyncLog = os.Getenv("MINIO_DSYNC_TRACE") == "1"
|
dsyncLog = os.Getenv("_MINIO_DSYNC_TRACE") == "1"
|
||||||
|
|
||||||
// lockRetryInterval specifies the maximum time between retries for failed locks.
|
// lockRetryInterval specifies the maximum time between retries for failed locks.
|
||||||
// Average retry time will be value / 2.
|
// Average retry time will be value / 2.
|
||||||
lockRetryInterval = 100 * time.Millisecond
|
lockRetryInterval = 250 * time.Millisecond
|
||||||
if lri := os.Getenv("_MINIO_LOCK_RETRY_INTERVAL"); lri != "" {
|
if lri := os.Getenv("_MINIO_LOCK_RETRY_INTERVAL"); lri != "" {
|
||||||
v, err := strconv.Atoi(lri)
|
v, err := strconv.Atoi(lri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user