Skip to content

Commit

Permalink
chore: pkg imported more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 26, 2023
1 parent 9b08997 commit 29b39ee
Showing 1 changed file with 3 additions and 5 deletions.
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 @@ import (
"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 @@ import (
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 @@ func (c *Container) sentinelInterceptor() grpc.UnaryServerInterceptor {
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

0 comments on commit 29b39ee

Please sign in to comment.