mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-18 14:39:49 +02:00
fix: high cpu usage
This commit is contained in:
@@ -39,6 +39,7 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
initProfiling()
|
||||
args := common.GetArgs()
|
||||
|
||||
switch args.Command {
|
||||
|
||||
5
cmd/main_production.go
Normal file
5
cmd/main_production.go
Normal file
@@ -0,0 +1,5 @@
|
||||
//go:build production
|
||||
|
||||
package main
|
||||
|
||||
func initProfiling() {}
|
||||
17
cmd/main_prof.go
Normal file
17
cmd/main_prof.go
Normal 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))
|
||||
}()
|
||||
}
|
||||
Reference in New Issue
Block a user