small upd

This commit is contained in:
Egor Aristov 2025-03-19 14:35:18 +03:00
parent 6421d0bfe8
commit 8da176ffba
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
3 changed files with 3 additions and 11 deletions

View File

@ -2,17 +2,9 @@ linters:
fast: true
presets:
- bugs
- comment
- complexity
- error
- format
- import
- metalinter
- module
- performance
- sql
- style
- test
- unused
disable:
- wsl

View File

@ -70,7 +70,7 @@ func main() {
log.Panicf("redis ping: %v", err)
}
perDomainLimiter, err := redisleaky.New(
perDomainLimiter := redisleaky.New(
rate.Every(time.Duration(float64(time.Second)*cfg.PerDomainRateLimitEvery)),
int64(cfg.PerDomainRateLimitCapacity),
redisClient,

View File

@ -28,7 +28,7 @@ func New(
capacity int64,
redisClient *redis.Client,
prefix string,
) (*Limiter, error) {
) *Limiter {
l := Limiter{
rate: time.Duration(float64(time.Second) / float64(rateLimit)),
capacity: capacity,
@ -36,7 +36,7 @@ func New(
redisPool: rsgoredis.NewPool(redisClient),
prefix: prefix,
}
return &l, nil
return &l
}
func (l *Limiter) Limit(ctx context.Context, key string) (time.Duration, error) {