fix: problem in burst limit

This commit is contained in:
Ashish Padhy 2023-12-07 19:06:02 +05:30 committed by GitHub
parent 461f6955d6
commit 251fe6a6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,9 +50,14 @@ func main() {
// Every 200 milliseconds we'll try to add a new // Every 200 milliseconds we'll try to add a new
// value to `burstyLimiter`, up to its limit of 3. // value to `burstyLimiter`, up to its limit of 3.
// If there is no space left then we continue.
go func() { go func() {
for t := range time.Tick(200 * time.Millisecond) { for t := range time.Tick(200 * time.Millisecond) {
burstyLimiter <- t select {
case burstyLimiter <- t:
default:
continue
}
} }
}() }()