Skip to content

Commit 571bf69

Browse files
authored
Fix new lint errors (#2020)
1 parent ab1c2fe commit 571bf69

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

post-policy.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,18 @@ func (p *PostPolicy) SetContentDisposition(contentDisposition string) error {
228228

229229
// SetContentLengthRange - Set new min and max content length
230230
// condition for all incoming uploads.
231-
func (p *PostPolicy) SetContentLengthRange(min, max int64) error {
232-
if min > max {
231+
func (p *PostPolicy) SetContentLengthRange(minLen, maxLen int64) error {
232+
if minLen > maxLen {
233233
return errInvalidArgument("Minimum limit is larger than maximum limit.")
234234
}
235-
if min < 0 {
235+
if minLen < 0 {
236236
return errInvalidArgument("Minimum limit cannot be negative.")
237237
}
238-
if max <= 0 {
238+
if maxLen <= 0 {
239239
return errInvalidArgument("Maximum limit cannot be non-positive.")
240240
}
241-
p.contentLengthRange.min = min
242-
p.contentLengthRange.max = max
241+
p.contentLengthRange.min = minLen
242+
p.contentLengthRange.max = maxLen
243243
return nil
244244
}
245245

retry-continous.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package minio
2020
import "time"
2121

2222
// newRetryTimerContinous creates a timer with exponentially increasing delays forever.
23-
func (c *Client) newRetryTimerContinous(unit, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
23+
func (c *Client) newRetryTimerContinous(baseSleep, maxSleep time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
2424
attemptCh := make(chan int)
2525

2626
// normalize jitter to the range [0, 1.0]
@@ -40,9 +40,9 @@ func (c *Client) newRetryTimerContinous(unit, cap time.Duration, jitter float64,
4040
attempt = maxAttempt
4141
}
4242
// sleep = random_between(0, min(cap, base * 2 ** attempt))
43-
sleep := unit * time.Duration(1<<uint(attempt))
44-
if sleep > cap {
45-
sleep = cap
43+
sleep := baseSleep * time.Duration(1<<uint(attempt))
44+
if sleep > maxSleep {
45+
sleep = maxSleep
4646
}
4747
if jitter != NoJitter {
4848
sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter)

retry.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var DefaultRetryCap = time.Second
4545

4646
// newRetryTimer creates a timer with exponentially increasing
4747
// delays until the maximum retry attempts are reached.
48-
func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, unit, cap time.Duration, jitter float64) <-chan int {
48+
func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, maxSleep time.Duration, jitter float64) <-chan int {
4949
attemptCh := make(chan int)
5050

5151
// computes the exponential backoff duration according to
@@ -60,9 +60,9 @@ func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, unit, cap time
6060
}
6161

6262
// sleep = random_between(0, min(cap, base * 2 ** attempt))
63-
sleep := unit * time.Duration(1<<uint(attempt))
64-
if sleep > cap {
65-
sleep = cap
63+
sleep := baseSleep * time.Duration(1<<uint(attempt))
64+
if sleep > maxSleep {
65+
sleep = maxSleep
6666
}
6767
if jitter != NoJitter {
6868
sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter)

0 commit comments

Comments
 (0)