尝试修复自动重载配置不成功的BUG

This commit is contained in:
wyx2685 2023-11-24 18:16:44 +09:00
parent 330f3b1449
commit 41b7cf8eb9
No known key found for this signature in database
GPG Key ID: 8827A30FF1DB1379
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,11 @@
package cmd
import (
"os"
"os/signal"
"runtime"
"syscall"
"github.com/InazumaV/V2bX/conf"
vCore "github.com/InazumaV/V2bX/core"
"github.com/InazumaV/V2bX/limiter"
@ -8,10 +13,6 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/natefinch/lumberjack.v2"
"os"
"os/signal"
"runtime"
"syscall"
)
var (
@ -95,6 +96,7 @@ func serverHandle(_ *cobra.Command, _ []string) {
log.WithField("err", err).Error("Restart node failed")
return
}
runtime.GC()
vc, err = vCore.NewCore(c.CoresConfig)
if err != nil {
log.WithField("err", err).Error("New core failed")
@ -112,7 +114,6 @@ func serverHandle(_ *cobra.Command, _ []string) {
return
}
log.Info("Nodes restarted")
runtime.GC()
})
if err != nil {
log.WithField("err", err).Error("start watch failed")

View File

@ -110,6 +110,10 @@ func (c *Controller) Close() error {
if c.onlineIpReportPeriodic != nil {
c.onlineIpReportPeriodic.Close()
}
err := c.server.DelNode(c.tag)
if err != nil {
return fmt.Errorf("del node error: %s", err)
}
return nil
}