go-sdk
go-sdk copied to clipboard
rpcClient.Block(&block) return context.DeadlineErr
When I execute with a single thread, I can get the correct block data, but when I execute the multithreading poll block, I will be prompted with contextDeadlineErr, how can I solve this problem?
client := rpc.NewRPCClient(node, types.ProdNetwork)
log.Printf("val:%v",client.IsActive())
result,err := client.Block(&height)
if err != nil {
log.Println(err)
}
log.Printf("result:%+v",result)
Commit{ BlockID: 0734FF08F7B1457F1A2D8E814278C13015EA851E3627E7AC4983ABE3D0B63410:1:62038ADF528B Precommits: Vote{0:1175946A48EA 94794637/00/2(Precommit) 0734FF08F7B1 0F42235199D3 @ 2020-06-17T00:53:19.443177364Z} Vote{1:14CFCE69B645 94794637/00/2(Precommit) 0734FF08F7B1 EF7842939D52 @ 2020-06-17T00:53:19.406146135Z} Vote{2:17B42E8F284D 94794637/00/2(Precommit) 0734FF08F7B1 75E27BF4DB75 @ 2020-06-17T00:53:19.322738826Z} Vote{3:3CD4AABABDDE 94794637/00/2(Precommit) 0734FF08F7B1 D2554F948147 @ 2020-06-17T00:53:19.417509992Z} Vote{4:414FB3BBA216 94794637/00/2(Precommit) 0734FF08F7B1 508A031A58E2 @ 2020-06-17T00:53:19.331686339Z} Vote{5:71F253E6FEA9 94794637/00/2(Precommit) 0734FF08F7B1 B07C1E7E87FF @ 2020-06-17T00:53:19.412730115Z} Vote{6:7235EF143D20 94794637/00/2(Precommit) 0734FF08F7B1 6EE0B995CFF1 @ 2020-06-17T00:53:19.432338549Z} Vote{7:A71E5CD078B8 94794637/00/2(Precommit) 0734FF08F7B1 5F07D456B1D0 @ 2020-06-17T00:53:19.407264513Z} Vote{8:A9157B3FA6EB 94794637/00/2(Precommit) 0734FF08F7B1 B53AEB332502 @ 2020-06-17T00:53:19.334087946Z} Vote{9:B0FBB52FF7EE 94794637/00/2(Precommit) 0734FF08F7B1 4968D0004632 @ 2020-06-17T00:53:19.334167035Z} Vote{10:B7707D9F593C 94794637/00/2(Precommit) 0734FF08F7B1 60F59655C3A0 @ 2020-06-17T00:53:19.439359261Z} }# }#3B74E90DAFC0D15FCE774D1421788800184D8A110F13B610DDC8695095246CB0}
hi, How many threads do you create? And how many requests per second? The processability of node is limited, it will be stuck with a large number of requests, so contextDeadlineErr is expected in that situation.
Okay.Because of Biance-chain generates blocks quickly, I need to implement block data monitoring through multi-threading. My solution is this: If the local database stores 100 blocks behind the main network block, I open 60 goroutines to do the block polling. At this point, I will appear contex.DeadlinetErr。
zjubfd [email protected] 于2020年6月22日周一 上午11:03写道:
hi, How many threads do you create? And how many requests per second? The processability of node is limited, it will be stuck with a large number of requests, so contextDeadlineErr is expected in that situation.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/binance-chain/go-sdk/issues/131#issuecomment-647242701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVHKACXZG7OPBBUOS7MDYTRX3CX3ANCNFSM4OAG3MGA .