Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pkg imported more than once #352

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions server/egrpc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"time"

sentinel "github.com/alibaba/sentinel-golang/api"
"github.com/alibaba/sentinel-golang/core/base"
sentinelBase "github.com/alibaba/sentinel-golang/core/base"
"github.com/gotomicro/ego/core/eerrors"
"github.com/gotomicro/ego/core/elog"
Expand All @@ -28,7 +27,6 @@
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc"
gcode "google.golang.org/grpc/codes"
grpcCode "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
Expand Down Expand Up @@ -400,15 +398,15 @@
var entry *sentinelBase.SentinelEntry = nil
entry, blockErr := sentinel.Entry(
resourceName,
sentinel.WithResourceType(base.ResTypeRPC),
sentinel.WithTrafficType(base.Inbound),
sentinel.WithResourceType(sentinelBase.ResTypeRPC),
sentinel.WithTrafficType(sentinelBase.Inbound),

Check warning on line 402 in server/egrpc/interceptor.go

View check run for this annotation

Codecov / codecov/patch

server/egrpc/interceptor.go#L401-L402

Added lines #L401 - L402 were not covered by tests
)
if blockErr != nil {
if c.config.unaryServerBlockFallback != nil {
return c.config.unaryServerBlockFallback(ctx, req, info, blockErr)
}

return nil, eerrors.New(int(gcode.ResourceExhausted), "blocked by sentinel", blockErr.Error())
return nil, eerrors.New(int(grpcCode.ResourceExhausted), "blocked by sentinel", blockErr.Error())

Check warning on line 409 in server/egrpc/interceptor.go

View check run for this annotation

Codecov / codecov/patch

server/egrpc/interceptor.go#L409

Added line #L409 was not covered by tests
}
defer entry.Exit()

Expand Down
Loading