Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new lint errors #2020

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
12 changes: 6 additions & 6 deletions post-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions retry-continous.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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<<uint(attempt))
if sleep > cap {
sleep = cap
sleep := baseSleep * time.Duration(1<<uint(attempt))
if sleep > maxSleep {
sleep = maxSleep
}
if jitter != NoJitter {
sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter)
Expand Down
8 changes: 4 additions & 4 deletions retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<<uint(attempt))
if sleep > cap {
sleep = cap
sleep := baseSleep * time.Duration(1<<uint(attempt))
if sleep > maxSleep {
sleep = maxSleep
}
if jitter != NoJitter {
sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter)
Expand Down
Loading