Skip to content

Commit

Permalink
chore: fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed May 10, 2024
1 parent 2569954 commit bbcc70a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ linters-settings:
severity: warning
disabled: true
govet:
check-shadowing: true
shadow: true
gocyclo:
min-complexity: 15
maligned:
Expand Down
8 changes: 4 additions & 4 deletions middleware/floodwait/simple_waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ func (w *SimpleWaiter) Handle(next tg.Invoker) telegram.InvokeFunc {

retries++

if max := w.maxRetries; max != 0 && retries > max {
return errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", retries, max, err)
if v := w.maxRetries; v != 0 && retries > v {
return errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", retries, v, err)
}

if d == 0 {
d = time.Second
}

if max := w.maxWait; max != 0 && d > max {
return errors.Errorf("flood wait argument is too big (%v > %v): %w", d, max, err)
if v := w.maxWait; v != 0 && d > v {
return errors.Errorf("flood wait argument is too big (%v > %v): %w", d, v, err)
}

if t == nil {
Expand Down
8 changes: 4 additions & 4 deletions middleware/floodwait/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ func (w *Waiter) send(s scheduled) (bool, error) {

s.request.retry++

if max := w.maxRetries; max != 0 && s.request.retry > max {
return true, errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", s.request.retry, max, err)
if v := w.maxRetries; v != 0 && s.request.retry > v {
return true, errors.Errorf("flood wait retry limit exceeded (%d > %d): %w", s.request.retry, v, err)
}

if d < time.Second {
d = time.Second
}
if max := w.maxWait; max != 0 && d > max {
return true, errors.Errorf("flood wait argument is too big (%v > %v): %w", d, max, err)
if v := w.maxWait; v != 0 && d > v {
return true, errors.Errorf("flood wait argument is too big (%v > %v): %w", d, v, err)
}

w.sch.flood(s.request, d)
Expand Down

0 comments on commit bbcc70a

Please sign in to comment.