Skip to content

Commit

Permalink
Refactor delay limit setting in request_limits.go
Browse files Browse the repository at this point in the history
The delay limit setting logic in 'request_limits.go' has been reorganized for increased efficiency. The changes ensure the correct delay value is consistently set in the structure. Additionally, newline characters have been included for better file readability.
  • Loading branch information
lueurxax committed Dec 22, 2023
1 parent 296c948 commit 33efce5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/repo/model/request_limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ func (r *RequestLimitsV2) CleanCounters() []RequestsV2 {
tt := batch.Start.Add(time.Duration(key+uint32(counter)) * time.Second)

if time.Since(tt) < window {
value := int32(tt.Sub(newStart).Seconds())
value := uint32(tt.Sub(newStart).Seconds())

if j != len(batch.Data)-1 {
data = batch.Data[j:]
data[0] = value
} else {
data = []uint32{value}
}

data[0] = uint32(value)

reached = true

break
Expand Down

0 comments on commit 33efce5

Please sign in to comment.