refactor: align framework cleanup with new bootstrap flow
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/response"
|
||||
)
|
||||
|
||||
// RateLimiter 创建基于 IP 的限流中间件
|
||||
@@ -23,7 +22,7 @@ func RateLimiter(max int, expiration time.Duration, storage fiber.Storage) fiber
|
||||
return constants.RedisRateLimitKey(c.IP())
|
||||
},
|
||||
LimitReached: func(c *fiber.Ctx) error {
|
||||
return response.Error(c, 429, errors.CodeTooManyRequests, errors.GetMessage(errors.CodeTooManyRequests, "zh"))
|
||||
return errors.New(errors.CodeTooManyRequests, errors.GetMessage(errors.CodeTooManyRequests, "zh"))
|
||||
},
|
||||
Storage: storage, // 支持内存或 Redis 存储
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user