fix: high cpu usage

This commit is contained in:
yusing
2025-01-22 05:44:04 +08:00
parent 3781bb93e1
commit b984386bab
12 changed files with 82 additions and 44 deletions

View File

@@ -39,6 +39,7 @@ func init() {
}
func main() {
initProfiling()
args := common.GetArgs()
switch args.Command {

5
cmd/main_production.go Normal file
View File

@@ -0,0 +1,5 @@
//go:build production
package main
func initProfiling() {}

17
cmd/main_prof.go Normal file
View File

@@ -0,0 +1,17 @@
//go:build pprof
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"runtime"
)
func initProfiling() {
runtime.GOMAXPROCS(2)
go func() {
log.Println(http.ListenAndServe(":7777", nil))
}()
}