should check if devServer Enabled, then call once.Do() (#4351)

Co-authored-by: william <myname@example.com>
This commit is contained in:
jursonmo 2024-09-03 08:54:43 +08:00 committed by GitHub
parent 90afa08367
commit 0cafb1164b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
})
}