(ctx context.Context, period time.Duration, dbID proto.DatabaseID, checkFunc func(profile *types.SQLChainProfile) bool)
| 642 | } |
| 643 | |
| 644 | func 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 | |
| 674 | const ROWSTART = 1000000 |
| 675 | const TABLENAME = "insert_table0" |
no test coverage detected