From a979baecd7a49c0c97ea68a0c713211f6309fdf2 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Sat, 7 Oct 2023 14:02:59 +0800 Subject: [PATCH] fix --- sm.go | 4 ++-- websocket.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sm.go b/sm.go index 651390a..6448be2 100644 --- a/sm.go +++ b/sm.go @@ -3,8 +3,8 @@ package fusenrender import ( "context" "encoding/gob" - "fmt" "io" + "log" "runtime" "sync" @@ -43,7 +43,7 @@ func NewSMQueue(shardID uint64, replicaID uint64) sm.IStateMachine { allocMB := float64(m.Alloc) / 1024 / 1024 // totalAllocMB := float64(m.TotalAlloc) / 1024 / 1024 sysMB := float64(m.Sys) / 1024 / 1024 - fmt.Printf("队列堆积数据: %d, Alloc = %.2f MB, Sys = %.2fMB\n", params.Value, allocMB, sysMB) + log.Printf("队列堆积数据: %d, Alloc = %.2f MB, Sys = %.2fMB\n", params.Value, allocMB, sysMB) } }), } diff --git a/websocket.go b/websocket.go index 420cad7..e1dfce6 100644 --- a/websocket.go +++ b/websocket.go @@ -42,14 +42,15 @@ func queueHandler(w http.ResponseWriter, r *http.Request) { raddr := conn.RemoteAddr() // laddr := conn.LocalAddr() - fmt.Printf("%s 建立连接 当前unity处理机器数量 %d\n", raddr, DequeueHandler.RefCountAdd(1)) + log.Printf("%s 建立连接 当前unity处理机器数量 %d\n", raddr, DequeueHandler.RefCountAdd(1)) defer func() { - fmt.Printf("%s 退出连接 当前unity处理机器数量 %d\n", raddr, DequeueHandler.RefCountAdd(-1)) + log.Printf("%s 退出连接 当前unity处理机器数量 %d\n", raddr, DequeueHandler.RefCountAdd(-1)) }() for { item := <-PopChannel + if item == nil { continue }