Skip to content

Commit

Permalink
尝试修复自动重载配置不成功的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
wyx2685 committed Nov 24, 2023
1 parent 330f3b1 commit 41b7cf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/server.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package cmd

import (
"os"
"os/signal"
"runtime"
"syscall"

"github.com/InazumaV/V2bX/conf"
vCore "github.com/InazumaV/V2bX/core"
"github.com/InazumaV/V2bX/limiter"
"github.com/InazumaV/V2bX/node"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/natefinch/lumberjack.v2"
"os"
"os/signal"
"runtime"
"syscall"
)

var (
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions node/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 41b7cf8

Please sign in to comment.