Compare commits

...
3 Commits
5 changed files with 12 additions and 6 deletions

No files matched your search

+1 -1
View File
@@ -1 +1 @@
5.9.3
5.9.4
+2
View File
@@ -1,3 +1,5 @@
### v5.9.4
* Добавлено логирование `requestId` в лог `throttling: rate limit has been reached for application`
### v5.9.3
* Исправлена опечатка при вызове `strings.TrimPrefix`
### v5.9.2
+1 -1
View File
@@ -10,7 +10,7 @@ require (
github.com/redis/go-redis/v9 v9.11.0
github.com/stretchr/testify v1.11.1
github.com/tomakado/websocketproxy v0.1.0
github.com/txix-open/isp-kit v1.65.1
github.com/txix-open/isp-kit v1.66.2
github.com/txix-open/jsonschema v1.3.0
golang.org/x/net v0.52.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c
+2 -2
View File
@@ -123,8 +123,8 @@ github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIg
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
github.com/txix-open/grmq v1.10.0 h1:1bXuF+7TxtUvoh+Wn6SOCYpVACFbWDuDmz/+tKwW9Ms=
github.com/txix-open/grmq v1.10.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.65.1 h1:KehXIJdPZMnewDd5XQxk87yNAtNhvJXApaLFvbUau5U=
github.com/txix-open/isp-kit v1.65.1/go.mod h1:F4B/+ErbNVaWzIIGasXM5DtcDKtjl6u2OESO02RyzCI=
github.com/txix-open/isp-kit v1.66.2 h1:+AFj7g9IeWiLSShmotrdheuJuwUNUYeL49D2d7PU3zo=
github.com/txix-open/isp-kit v1.66.2/go.mod h1:F4B/+ErbNVaWzIIGasXM5DtcDKtjl6u2OESO02RyzCI=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
+6 -2
View File
@@ -5,10 +5,12 @@ import (
"fmt"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/requestid"
)
type Throttler interface {
@@ -28,10 +30,12 @@ func Throttling(throttler Throttler) Middleware {
return errors.WithMessage(err, "throttling: allow rate limit")
}
if !result.Allow {
requestId := requestid.FromContext(ctx.Context())
return httperrors.New(
http.StatusTooManyRequests,
fmt.Sprintf("rate limit has been reached, try after %dms", result.RetryAfter.Milliseconds()),
errors.Errorf("throttling: rate limit has been reached for application '%d'", authData.ApplicationId),
errors.Errorf("throttling: rate limit has been reached for application '%d', requestId '%s'",
authData.ApplicationId, requestId),
)
}