优化本地数据库性能
This commit is contained in:
@@ -604,9 +604,8 @@ func (this *Node) listenSignals() {
|
||||
signal.Notify(queue, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL, syscall.SIGQUIT)
|
||||
goman.New(func() {
|
||||
for range queue {
|
||||
events.Notify(events.EventTerminated)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
os.Exit(0)
|
||||
utils.Exit()
|
||||
return
|
||||
}
|
||||
})
|
||||
@@ -650,7 +649,7 @@ func (this *Node) listenSock() error {
|
||||
|
||||
// 退出主进程
|
||||
events.Notify(events.EventQuit)
|
||||
os.Exit(0)
|
||||
utils.Exit()
|
||||
case "quit":
|
||||
_ = cmd.ReplyOk()
|
||||
_ = this.sock.Close()
|
||||
@@ -662,7 +661,7 @@ func (this *Node) listenSock() error {
|
||||
for {
|
||||
countActiveConnections := sharedListenerManager.TotalActiveConnections()
|
||||
if countActiveConnections <= 0 {
|
||||
os.Exit(0)
|
||||
utils.Exit()
|
||||
return
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
@@ -228,7 +228,7 @@ func (this *UpgradeManager) unzip(zipPath string) error {
|
||||
func (this *UpgradeManager) restart() error {
|
||||
// 重新启动
|
||||
if DaemonIsOn && DaemonPid == os.Getppid() {
|
||||
os.Exit(0) // TODO 试着更优雅重启
|
||||
utils.Exit() // TODO 试着更优雅重启
|
||||
} else {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
@@ -238,6 +238,9 @@ func (this *UpgradeManager) restart() error {
|
||||
// quit
|
||||
events.Notify(events.EventQuit)
|
||||
|
||||
// terminated
|
||||
events.Notify(events.EventTerminated)
|
||||
|
||||
// 启动
|
||||
cmd := exec.Command(exe, "start")
|
||||
err = cmd.Start()
|
||||
|
||||
Reference in New Issue
Block a user