urltest: force refresh history while starting it

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
This commit is contained in:
iosmanthus 2024-07-04 15:50:02 +08:00
parent 085f603377
commit c8690dedc3
No known key found for this signature in database
GPG Key ID: DEE5BAABFE092169
2 changed files with 10 additions and 8 deletions

View File

@ -78,8 +78,10 @@ func (s *Server) downloadExternalUI() error {
err = s.downloadZIP(filepath.Base(downloadURL), response.Body, s.externalUI) err = s.downloadZIP(filepath.Base(downloadURL), response.Body, s.externalUI)
if err != nil { if err != nil {
removeAllInDirectory(s.externalUI) removeAllInDirectory(s.externalUI)
return err
} }
return err s.logger.Info("download external ui successfully")
return nil
} }
func (s *Server) downloadZIP(name string, body io.Reader, output string) error { func (s *Server) downloadZIP(name string, body io.Reader, output string) error {

View File

@ -88,12 +88,7 @@ func (s *URLTest) Start() error {
return err return err
} }
s.group = group s.group = group
return nil return s.group.Start()
}
func (s *URLTest) PostStart() error {
s.group.PostStart()
return nil
} }
func (s *URLTest) Close() error { func (s *URLTest) Close() error {
@ -253,10 +248,15 @@ func NewURLTestGroup(
}, nil }, nil
} }
func (g *URLTestGroup) PostStart() { func (g *URLTestGroup) Start() error {
_, err := g.urlTest(g.ctx, true)
if err != nil {
return E.New("failed to start urltest group: ", err)
}
g.started = true g.started = true
g.lastActive.Store(time.Now()) g.lastActive.Store(time.Now())
go g.CheckOutbounds(false) go g.CheckOutbounds(false)
return nil
} }
func (g *URLTestGroup) Touch() { func (g *URLTestGroup) Touch() {