Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-06-08 04:37:18 +03:00
parent 594465269a
commit f7579670cc

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"flag"
"fmt"
"golang.org/x/time/rate"
"io"
"math/rand"
"mime"
@@ -11,9 +12,8 @@ import (
"os"
"path/filepath"
"strings"
"time"
"sync"
"golang.org/x/time/rate"
"time"
)
var (
@@ -37,7 +37,7 @@ func getLimiter(ip string) *rate.Limiter {
defer limMu.Unlock()
lim, ok := limiters[ip]
if !ok {
lim = rate.NewLimiter(1, 5) // 1 req/sec, burst of 5
lim = rate.NewLimiter(rate.Every(5*time.Second), 1)
limiters[ip] = lim
}
return lim