优化本地数据库性能

This commit is contained in:
刘祥超
2022-03-15 18:32:39 +08:00
parent ddebc0e4a8
commit 21e206061d
13 changed files with 940 additions and 515 deletions

View File

@@ -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)

View File

@@ -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()