binance: use fastjson parser pool

This commit is contained in:
c9s 2021-06-28 14:19:14 +08:00 committed by c9s
parent 565cdef54f
commit 2ec01e3d28
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -296,9 +296,11 @@ type ResultEvent struct {
ID int `json:"id"` ID int `json:"id"`
} }
func parseWebSocketEvent(message []byte) (interface{}, error) { var parserPool fastjson.ParserPool
val, err := fastjson.ParseBytes(message)
func parseWebSocketEvent(message []byte) (interface{}, error) {
parser := parserPool.Get()
val, err := parser.Parse(message)
if err != nil { if err != nil {
return nil, err return nil, err
} }