增加edge-node gc命令

This commit is contained in:
GoEdgeLab
2022-01-01 17:18:34 +08:00
parent ba587d9ba6
commit 6606fa049d
2 changed files with 10 additions and 0 deletions

View File

@@ -117,6 +117,15 @@ func main() {
}
}
})
app.On("gc", func() {
var sock = gosock.NewTmpSock(teaconst.ProcessName)
_, err := sock.Send(&gosock.Command{Code: "gc"})
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
fmt.Println("ok")
}
})
app.Run(func() {
node := nodes.NewNode()
node.Start()

View File

@@ -639,6 +639,7 @@ func (this *Node) listenSock() error {
case "gc":
runtime.GC()
debug.FreeOSMemory()
_ = cmd.ReplyOk()
}
})