fix stuck loading in some scenerios for ls-* command line options

This commit is contained in:
yusing
2024-09-22 05:01:36 +08:00
parent 46281aa3b0
commit d9fd399e43
4 changed files with 13 additions and 9 deletions

View File

@@ -80,8 +80,6 @@ func main() {
return
}
cfg.StartProxyProviders()
if args.Command == common.CommandListRoutes {
printJSON(cfg.RoutesByAlias())
return
@@ -92,6 +90,8 @@ func main() {
return
}
cfg.StartProxyProviders()
if err.HasError() {
l.Warn(err)
}
@@ -177,10 +177,11 @@ func main() {
close(done)
}()
timeout := time.After(time.Duration(cfg.Value().TimeoutShutdown) * time.Second)
select {
case <-done:
logrus.Info("shutdown complete")
case <-time.After(time.Duration(cfg.Value().TimeoutShutdown) * time.Second):
case <-timeout:
logrus.Info("timeout waiting for shutdown")
}
}