fix: ws消息无消费chan溢出关闭

This commit is contained in:
TsMask
2024-01-30 17:20:25 +08:00
parent 3c67c5fd59
commit 3554fc341d

View File

@@ -41,6 +41,10 @@ func (s *WSSendImpl) ByClientID(clientID string, data any) error {
}
client := v.(*model.WSClient)
if len(client.MsgChan) > 90 {
NewWSImpl.CloseClient(client.ID)
return fmt.Errorf("msg chan over 90 will close client ID: %s", clientID)
}
client.MsgChan <- dataByte
return nil
}