MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / testPCaller

Function testPCaller

rpc/pool_test.go:75–92  ·  view source on GitHub ↗
(c C, wg *sync.WaitGroup, pool NOClientPool, remote proto.NodeID, con int, quest int)

Source from the content-addressed store, hash-verified

73}
74
75func testPCaller(c C, wg *sync.WaitGroup, pool NOClientPool, remote proto.NodeID, con int, quest int) {
76 defer wg.Done()
77 var finished int32
78 caller := NewPersistentCallerWithPool(pool, remote)
79 defer caller.Close()
80 iwg := &sync.WaitGroup{}
81 defer iwg.Wait()
82 for i := 0; i < con; i++ {
83 iwg.Add(1)
84 go func(c C) {
85 defer iwg.Done()
86 for atomic.AddInt32(&finished, 1) < int32(quest) {
87 err := caller.Call("Count.Add", &AddReq{Delta: 1}, &AddResp{})
88 c.So(err, ShouldBeNil)
89 }
90 }(c)
91 }
92}
93
94func BenchmarkRPCComponents(b *testing.B) {
95 originLevel := log.GetLevel()

Callers 1

TestRPCComponentsFunction · 0.85

Calls 5

WaitMethod · 0.80
CloseMethod · 0.65
CallMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected