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

Function waitProfileChecking

cmd/cql-minerd/integration_test.go:644–672  ·  view source on GitHub ↗
(ctx context.Context, period time.Duration, dbID proto.DatabaseID,
	checkFunc func(profile *types.SQLChainProfile) bool)

Source from the content-addressed store, hash-verified

642}
643
644func waitProfileChecking(ctx context.Context, period time.Duration, dbID proto.DatabaseID,
645 checkFunc func(profile *types.SQLChainProfile) bool) (err error) {
646 var (
647 ticker = time.NewTicker(period)
648 req = &types.QuerySQLChainProfileReq{}
649 resp = &types.QuerySQLChainProfileResp{}
650 )
651 defer ticker.Stop()
652 req.DBID = dbID
653
654 for {
655 select {
656 case <-ticker.C:
657 err = rpc.RequestBP(route.MCCQuerySQLChainProfile.String(), req, resp)
658 if err == nil {
659 if checkFunc(&resp.Profile) {
660 return
661 }
662 log.WithFields(log.Fields{
663 "dbID": resp.Profile.Address,
664 "num_of_user": len(resp.Profile.Users),
665 }).Debugf("get profile but failed to check in waitProfileChecking")
666 }
667 case <-ctx.Done():
668 err = ctx.Err()
669 return
670 }
671 }
672}
673
674const ROWSTART = 1000000
675const TABLENAME = "insert_table0"

Callers 1

TestFullProcessFunction · 0.70

Calls 4

WithFieldsFunction · 0.92
DebugfMethod · 0.80
StopMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected