Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Sleep" at the first operation #508

Open
Vladimir-Khm opened this issue Aug 27, 2023 · 0 comments
Open

"Sleep" at the first operation #508

Vladimir-Khm opened this issue Aug 27, 2023 · 0 comments

Comments

@Vladimir-Khm
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant