mirror of
https://github.com/fiatjaf/khatru.git
synced 2025-04-06 10:58:45 +02:00
actually we don't need all that fluff.
This commit is contained in:
parent
635e91f360
commit
e25400a61a
@ -1,7 +1,6 @@
|
||||
package policies
|
||||
|
||||
import (
|
||||
"iter"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@ -19,7 +18,7 @@ func startRateLimitSystem[K comparable](
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(interval)
|
||||
for key, bucket := range iter.Seq2[K, *atomic.Int32](negativeBuckets.Range) {
|
||||
for key, bucket := range negativeBuckets.Range {
|
||||
newv := bucket.Add(int32(-tokensPerInterval))
|
||||
if newv <= 0 {
|
||||
negativeBuckets.Delete(key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user