显示提示日志
This commit is contained in:
parent
b177e0c9ab
commit
7282835430
9
sm.go
9
sm.go
|
@ -42,13 +42,12 @@ func NewSMQueue(shardID uint64, replicaID uint64) sm.IStateMachine {
|
|||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
allocMB := float64(m.Alloc) / 1024 / 1024
|
||||
totalAllocMB := float64(m.TotalAlloc) / 1024 / 1024
|
||||
// totalAllocMB := float64(m.TotalAlloc) / 1024 / 1024
|
||||
sysMB := float64(m.Sys) / 1024 / 1024
|
||||
fmt.Printf("queue remain: %d, Alloc = %.2f MB, TotalAlloc = %.2f MB, Sys = %.2f MB\n", params.Value, allocMB, totalAllocMB, sysMB)
|
||||
|
||||
time.Sleep(time.Second * 5)
|
||||
fmt.Printf("队列 剩余: %d, Alloc = %.2f MB, Sys = %.2f MB\n", params.Value, allocMB, sysMB)
|
||||
time.Sleep(time.Second * 1)
|
||||
} else {
|
||||
time.Sleep(time.Second * 15)
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
|
|
@ -74,9 +74,7 @@ var FsPasser *passer.Passer[sm.Result] = func() *passer.Passer[sm.Result] {
|
|||
e.Result.Data = d
|
||||
result.Data = d
|
||||
if !queue.Empty() {
|
||||
size := queue.Size()
|
||||
|
||||
smqueue.counter.Notify(size)
|
||||
smqueue.counter.Notify(queue.Size())
|
||||
}
|
||||
|
||||
// log.Println("queue remain:", queue.Size())
|
||||
|
|
|
@ -68,7 +68,7 @@ func queueHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
err = conn.SetWriteDeadline(time.Now().Add(time.Second * 8))
|
||||
err = conn.SetWriteDeadline(time.Now().Add(time.Second * 6))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
log.Println("重新回队")
|
||||
|
@ -84,8 +84,9 @@ func queueHandler(w http.ResponseWriter, r *http.Request) {
|
|||
stateClient.PushItem(nil, item)
|
||||
return
|
||||
}
|
||||
|
||||
// 打印消息
|
||||
fmt.Printf("%s 处理完成. len\n", conn.RemoteAddr())
|
||||
fmt.Printf("%s 的数据 推送到unity. source %s\n", conn.RemoteAddr(), item.Source)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user