Roc 11 tháng trước cách đây
mục cha
commit
84730a6767
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      main.go

+ 8 - 0
main.go

@@ -4,6 +4,8 @@ import (
 	"eta/eta_api/controllers"
 	"eta/eta_api/services/alarm_msg"
 	"fmt"
+	"log"
+	"net/http"
 	"runtime"
 	"time"
 
@@ -14,6 +16,7 @@ import (
 	"github.com/beego/beego/v2/adapter/logs"
 	"github.com/beego/beego/v2/server/web"
 	"github.com/beego/beego/v2/server/web/context"
+	_ "net/http/pprof"
 )
 
 func main() {
@@ -23,6 +26,11 @@ func main() {
 	}
 	go services.Task()
 
+	// 启动pprof服务
+	go func() {
+		log.Println(http.ListenAndServe(":6060", nil))
+	}()
+	
 	// 异常处理
 	web.ErrorController(&controllers.ErrorController{})