Skip to content

Commit 73540d9

Browse files
committed
optimize(gRPC): do not log when there is no active gRPC connection
1 parent 8124ee3 commit 73540d9

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
@@ -380,11 +380,15 @@ func (t *svrTransHandler) SetPipeline(p *remote.TransPipeline) {
380380
}
381381

382382
func (t *svrTransHandler) GracefulShutdown(ctx context.Context) error {
383+
t.mu.Lock()
384+
if t.li.Len() == 0 {
385+
t.mu.Unlock()
386+
return nil
387+
}
383388
klog.Info("KITEX: gRPC GracefulShutdown starts")
384389
defer func() {
385390
klog.Info("KITEX: gRPC GracefulShutdown ends")
386391
}()
387-
t.mu.Lock()
388392
for elem := t.li.Front(); elem != nil; elem = elem.Next() {
389393
svrTrans := elem.Value.(*SvrTrans)
390394
svrTrans.tr.Drain()

0 commit comments

Comments
 (0)