Skip to content

Commit

Permalink
Fix wait time based deadline calculation (#3120)
Browse files Browse the repository at this point in the history
### Description of change

##### Checklist

- [x] Tested in playground or other setup
- [ ] Screenshot (Grafana) from playground added to PR for 15+ minute
run
- [ ] Documentation is changed or added
- [ ] Tests and/or benchmarks are included
- [ ] Breaking changes
  • Loading branch information
tanveergill authored Jan 4, 2024
1 parent 4fefe0b commit b4abafb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/dmap-funcs/concurrency-limiter/global-token-counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ func (gtc *GlobalTokenCounter) takeN(key string, stateBytes, argBytes []byte) ([
} else {
waitTime = MinimumWaitTime
}
if waitTime < MinimumWaitTime {
waitTime = MinimumWaitTime
}
if requestQueued != nil {
if requestQueued.NumRetries >= 5 {
// override wait time if the request has been retried more than 5 times
Expand All @@ -424,6 +421,12 @@ func (gtc *GlobalTokenCounter) takeN(key string, stateBytes, argBytes []byte) ([
waitTime = requestQueued.WaitFor.AsDuration() * 2
}
}
if waitTime < MinimumWaitTime {
waitTime = MinimumWaitTime
}
if waitTime > MaximumWaitTime {
waitTime = MaximumWaitTime
}

var requestsInflight []*tokencounterv1.Request
var tokensInflight float64
Expand Down

0 comments on commit b4abafb

Please sign in to comment.