Skip to content

Commit baaa9a4

Browse files
committed
optimize(gRPC): do not log when there is no active gRPC connection
1 parent b36d010 commit baaa9a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/remote/trans/nphttp2/server_handler.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,15 @@ func (t *svrTransHandler) SetPipeline(p *remote.TransPipeline) {
391391
}
392392

393393
func (t *svrTransHandler) GracefulShutdown(ctx context.Context) error {
394+
t.mu.Lock()
395+
if t.li.Len() == 0 {
396+
t.mu.Unlock()
397+
return nil
398+
}
394399
klog.Info("KITEX: gRPC GracefulShutdown starts")
395400
defer func() {
396401
klog.Info("KITEX: gRPC GracefulShutdown ends")
397402
}()
398-
t.mu.Lock()
399403
for elem := t.li.Front(); elem != nil; elem = elem.Next() {
400404
svrTrans := elem.Value.(*SvrTrans)
401405
svrTrans.tr.Drain()

0 commit comments

Comments
 (0)