Skip to content

Commit 9225a8d

Browse files
committed
Bump version to v1.24.2
1 parent 40e4908 commit 9225a8d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

cmd/daze/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var Conf = struct {
3131
}{
3232
PathRule: "/rule.ls",
3333
PathCIDR: "/rule.cidr",
34-
Version: "v1.24.1",
34+
Version: "v1.24.2",
3535
}
3636

3737
const helpMsg = `Usage: daze <command> [<args>]

lib/rate/rate.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Limits struct {
2222
// Wait ensures there are enough resources (n) available, blocking if necessary.
2323
func (l *Limits) Wait(n uint64) {
2424
doa.Doa(n < math.MaxUint64/2)
25+
doa.Doa(l.size <= l.capacity)
2526
l.mu.Lock()
2627
defer l.mu.Unlock()
2728
l.loop = uint64(time.Since(l.last) / l.step)
@@ -55,14 +56,14 @@ func NewLimits(r uint64, p time.Duration) *Limits {
5556
}
5657
return a
5758
}(r, uint64(p))
58-
r = r / g
59-
p = p / time.Duration(g)
59+
a := r / g
60+
s := p / time.Duration(g)
6061
return &Limits{
61-
addition: r,
62-
capacity: r * 2,
62+
addition: a,
63+
capacity: r,
6364
last: time.Now(),
6465
mu: sync.Mutex{},
6566
size: r,
66-
step: p,
67+
step: s,
6768
}
6869
}

0 commit comments

Comments
 (0)