Blocks when using bg.connect
What version of gotd are you using?
v 0.102.0
Can this issue be reproduced with the latest version?
Yes
What did you do?
I'm starting multiple clients that share hashes and ids. When I start to the new client, according to this example, use bg.Connect method, I found that blocking happens, I go to connect debug and find that initDone cannot be executed.But when I rebooted, I found that the existing clients started bg.Connect normally and did not block, as if this only happened when I had started and wanted to add an account client. And occasionally it gets to initDone when I debug. I mean is it asynchronous processing?
My code snippet is like this, every time I start an client, I will batch execute this code, and it will normally reach the bg Connect done log, but when I batch start successfully, I want to add another instance, and then execute this code, I will block at resolver done.
client := telegram.NewClient(apiID, apiHash, options)
fmt.Println("[Start] CManager done")
resolver := storage.NewResolverCache(peer.Plain(api), peerDB)
_ = resolver
fmt.Println("[Start] resolver done")
_, err = bg.Connect(client, bg.WithContext(ctx))
if err != nil {
fmt.Println("Connect err", err)
return err
}
fmt.Println("[Start] bg Connect done")
What did you expect to see?
I want to be able to add new instances after I've started an existing one without blocking
What Go version and environment are you using?
go v1.21