From 0cafb1164be7543fc47a34eb85674f7f6f599acd Mon Sep 17 00:00:00 2001 From: jursonmo <294696971@qq.com> Date: Tue, 3 Sep 2024 08:54:43 +0800 Subject: [PATCH] should check if devServer Enabled, then call once.Do() (#4351) Co-authored-by: william --- internal/devserver/server.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/devserver/server.go b/internal/devserver/server.go index e65722716c09..069612b1f358 100644 --- a/internal/devserver/server.go +++ b/internal/devserver/server.go @@ -77,10 +77,11 @@ func (s *Server) StartAsync(c Config) { // StartAgent start inner http server by config. func StartAgent(c Config) { + if !c.Enabled { + return + } once.Do(func() { - if c.Enabled { - s := NewServer(c) - s.StartAsync(c) - } + s := NewServer(c) + s.StartAsync(c) }) }