feat(login): 添加请求速率限制中间件并启用pprof锁和阻塞跟踪

This commit is contained in:
1
2025-10-24 06:04:28 +00:00
parent 18378a3ab6
commit 749b380d82
4 changed files with 27 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"runtime"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"github.com/gogf/gf/v2/os/gproc"
@@ -20,6 +21,8 @@ import (
)
func PprofWeb() {
runtime.SetMutexProfileFraction(1) // (非必需)开启对锁调用的跟踪
runtime.SetBlockProfileRate(1) // (非必需)开启对阻塞操作的跟踪
err := http.ListenAndServe(":9909", nil)
if err != nil {
panic(err)