We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
max
1 parent cad0b97 commit 26e1522Copy full SHA for 26e1522
internal/hammer/loadtest/throttle.go
@@ -40,10 +40,7 @@ func (t *Throttle) Increase() {
40
t.mu.Lock()
41
defer t.mu.Unlock()
42
tokenCount := t.opsPerSecond
43
- delta := float64(tokenCount) * 0.1
44
- if delta < 1 {
45
- delta = 1
46
- }
+ delta := max(float64(tokenCount)*0.1, 1)
47
t.opsPerSecond = tokenCount + int(delta)
48
}
49
@@ -54,10 +51,7 @@ func (t *Throttle) Decrease() {
54
51
if tokenCount <= 1 {
55
52
return
56
53
57
58
59
60
61
t.opsPerSecond = tokenCount - int(delta)
62
63
0 commit comments