feat: reduce default bucket capacity for rate limiting

This commit is contained in:
2025-09-01 23:38:47 +03:00
parent 61775a6bb8
commit 45afc8fa31

View File

@@ -4,15 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/redis/rueidis"
"net/http"
"sipro-mps/internal/redis"
"sipro-mps/pkg/utils"
"time"
"github.com/redis/rueidis"
)
const (
defaultBucketCapacity = 10 // max burst size
defaultBucketCapacity = 5 // max burst size
refillRate = 100.0 / 60000 // 300 requests per minute → 1 token per 200ms
tokenTTLMillis = 60000 // Redis key TTL: 60s
)