From 571bf6900f5ab8993c08e5c5a7e8ffc40e1fb4a2 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 21 Nov 2024 02:56:56 -0800 Subject: [PATCH] Fix new lint errors (#2020) --- post-policy.go | 12 ++++++------ retry-continous.go | 8 ++++---- retry.go | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/post-policy.go b/post-policy.go index 19687e027d..b5414af293 100644 --- a/post-policy.go +++ b/post-policy.go @@ -228,18 +228,18 @@ func (p *PostPolicy) SetContentDisposition(contentDisposition string) error { // SetContentLengthRange - Set new min and max content length // condition for all incoming uploads. -func (p *PostPolicy) SetContentLengthRange(min, max int64) error { - if min > max { +func (p *PostPolicy) SetContentLengthRange(minLen, maxLen int64) error { + if minLen > maxLen { return errInvalidArgument("Minimum limit is larger than maximum limit.") } - if min < 0 { + if minLen < 0 { return errInvalidArgument("Minimum limit cannot be negative.") } - if max <= 0 { + if maxLen <= 0 { return errInvalidArgument("Maximum limit cannot be non-positive.") } - p.contentLengthRange.min = min - p.contentLengthRange.max = max + p.contentLengthRange.min = minLen + p.contentLengthRange.max = maxLen return nil } diff --git a/retry-continous.go b/retry-continous.go index bfeea95f30..0b92611b80 100644 --- a/retry-continous.go +++ b/retry-continous.go @@ -20,7 +20,7 @@ package minio import "time" // newRetryTimerContinous creates a timer with exponentially increasing delays forever. -func (c *Client) newRetryTimerContinous(unit, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int { +func (c *Client) newRetryTimerContinous(baseSleep, maxSleep time.Duration, jitter float64, doneCh chan struct{}) <-chan int { attemptCh := make(chan int) // normalize jitter to the range [0, 1.0] @@ -40,9 +40,9 @@ func (c *Client) newRetryTimerContinous(unit, cap time.Duration, jitter float64, attempt = maxAttempt } // sleep = random_between(0, min(cap, base * 2 ** attempt)) - sleep := unit * time.Duration(1< cap { - sleep = cap + sleep := baseSleep * time.Duration(1< maxSleep { + sleep = maxSleep } if jitter != NoJitter { sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter) diff --git a/retry.go b/retry.go index d15eb59013..15f4dca4fb 100644 --- a/retry.go +++ b/retry.go @@ -45,7 +45,7 @@ var DefaultRetryCap = time.Second // newRetryTimer creates a timer with exponentially increasing // delays until the maximum retry attempts are reached. -func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, unit, cap time.Duration, jitter float64) <-chan int { +func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, maxSleep time.Duration, jitter float64) <-chan int { attemptCh := make(chan int) // computes the exponential backoff duration according to @@ -60,9 +60,9 @@ func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, unit, cap time } // sleep = random_between(0, min(cap, base * 2 ** attempt)) - sleep := unit * time.Duration(1< cap { - sleep = cap + sleep := baseSleep * time.Duration(1< maxSleep { + sleep = maxSleep } if jitter != NoJitter { sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter)