HuobiRDCenter / huobi_Golang

Go SDK for Huobi Spot API
https://www.htx.com/zh-cn/opend/newApiPages/
Apache License 2.0
176 stars 86 forks source link

PerfLogger data race #19

Closed filinvadim closed 3 years ago

filinvadim commented 4 years ago
WARNING: DATA RACE
Read at 0x0000020d07f0 by goroutine 25:
  .../logging/perflogger.GetInstance()
     .../logging/perflogger/performancelogger.go:29 +0x65

Previous write at 0x0000020d07f0 by goroutine 24:
  .../logging/perflogger.GetInstance()
     .../logging/perflogger/performancelogger.go:30 +0x3d5
eynzhang commented 3 years ago

@filinvadim PerformanceLogger is not part of SDK client package, it is used to measure the performance and not designed as thread safe. You can simply remove the logging in HttpGet() and HttpPost().

Anyway I have fixed this in master branch, I moved the initialization into Enable() so that GetInstance() is thread safe.