Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x/time/rate: correctly handle 0 limits
Decrementing the burst in the reserveN method will frequently lead to us setting the burst to 0 which makes the limiter mostly unusable. This code was originally added in https://go.dev/cl/323429 to fix #39984 but the implementation introduced a different bug. To avoid regressing to the behaviour described in #39984, pre-fill the limiter to the burst value in the constructor. Fixes #68541 Change-Id: Iab3b85d548a44fcb2d058336e5bbf11b19ea67b1 Reviewed-on: https://go-review.googlesource.com/c/time/+/600876 Reviewed-by: Sameer Ajmani <sameer@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Sameer Ajmani <sameer@golang.org>
- Loading branch information