go-binance
go-binance copied to clipboard
"Sleep" at the first operation
I tried to test ping with this simple code:
package main
import (
"context"
"fmt"
"time"
binance_connector "github.com/adshao/go-binance/v2"
)
func main() {
Ping()
}
func Ping() {
client := binance_connector.NewClient("", "")
ping := client.NewPingService()
for i:= 0; i < 20; i++ {
start := time.Now()
ping.Do(context.Background())
fmt.Println(time.Since(start))
}
}
And I always got results like these:
125.41625ms 5.679ms 9.238927ms 8.646379ms 5.173076ms 5.798899ms 7.397644ms 6.460718ms 4.268116ms 5.672282ms 7.209897ms 6.009768ms 7.882153ms 7.774738ms 6.263361ms 9.195017ms 7.095737ms 5.364541ms 5.901158ms 4.376399ms
The first result was always in many times higher then other 19.
Initially I have tasted it separately and couldn't understand why is there such a big number. Code was run on Windows and Ubuntu with the same result and with different versions of go. I think it works not in an appropriate way. The same program with python-binance works fine