refactor: 移除冗余日志输出并优化日志处理
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -66,7 +66,7 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) {
|
||||
v.LF.Close()
|
||||
if v.Player != nil {
|
||||
v.SaveL.Do(func() { //使用保存锁,确保在踢人和掉线的时候只保存一次
|
||||
//cool.Loger.Info(context.TODO(), "准备保存", v.Player.Info.UserID)
|
||||
|
||||
v.Player.Save() //保存玩家数据
|
||||
|
||||
})
|
||||
@@ -88,8 +88,6 @@ func (s *Server) OnTick() (delay time.Duration, action gnet.Action) {
|
||||
func (s *Server) OnBoot(eng gnet.Engine) gnet.Action {
|
||||
s.eng = eng
|
||||
|
||||
// cool.Loger.Infof(context.Background(), " server is listening on %s\n", s.addr)
|
||||
|
||||
return gnet.None
|
||||
}
|
||||
|
||||
@@ -188,7 +186,7 @@ func (s *Server) handleTCP(conn gnet.Conn) (action gnet.Action) {
|
||||
|
||||
if conn.InboundBuffered() > 0 {
|
||||
if err := conn.Wake(nil); err != nil { // wake up the connection manually to avoid missing the leftover data
|
||||
cool.Logger.Errorf(context.Background(), "failed to wake up the connection, %v", err)
|
||||
|
||||
return gnet.Close
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user