mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
refactor zrpc server interceptor builder (#4300)
This commit is contained in:
@@ -3,7 +3,6 @@ package internal
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stat"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/health"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
@@ -27,7 +26,6 @@ type (
|
||||
baseRpcServer struct {
|
||||
address string
|
||||
health *health.Server
|
||||
metrics *stat.Metrics
|
||||
options []grpc.ServerOption
|
||||
streamInterceptors []grpc.StreamServerInterceptor
|
||||
unaryInterceptors []grpc.UnaryServerInterceptor
|
||||
@@ -42,7 +40,6 @@ func newBaseRpcServer(address string, rpcServerOpts *rpcServerOptions) *baseRpcS
|
||||
return &baseRpcServer{
|
||||
address: address,
|
||||
health: h,
|
||||
metrics: rpcServerOpts.metrics,
|
||||
options: []grpc.ServerOption{grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||
MaxConnectionIdle: defaultConnectionIdleDuration,
|
||||
})},
|
||||
@@ -60,7 +57,3 @@ func (s *baseRpcServer) AddStreamInterceptors(interceptors ...grpc.StreamServerI
|
||||
func (s *baseRpcServer) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) {
|
||||
s.unaryInterceptors = append(s.unaryInterceptors, interceptors...)
|
||||
}
|
||||
|
||||
func (s *baseRpcServer) SetName(name string) {
|
||||
s.metrics.SetName(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user