donot wait when not test

This commit is contained in:
yedf2 2021-07-28 23:55:16 +08:00
parent 4a7d1f0dee
commit 0c7913fef1
2 changed files with 4 additions and 5 deletions

View File

@ -61,9 +61,5 @@ func (s *Msg) Prepare(queryPrepared string) error {
s.QueryPrepared = common.OrString(queryPrepared, s.QueryPrepared) s.QueryPrepared = common.OrString(queryPrepared, s.QueryPrepared)
logrus.Printf("preparing %s body: %v", s.Gid, &s.MsgData) logrus.Printf("preparing %s body: %v", s.Gid, &s.MsgData)
resp, err := common.RestyClient.R().SetBody(&s.MsgData).Post(fmt.Sprintf("%s/prepare", s.Server)) resp, err := common.RestyClient.R().SetBody(&s.MsgData).Post(fmt.Sprintf("%s/prepare", s.Server))
rerr := CheckDtmResponse(resp, err) return CheckDtmResponse(resp, err)
if rerr != nil {
return rerr
}
return nil
} }

View File

@ -38,6 +38,9 @@ var TransProcessedTestChan chan string = nil
// WaitTransProcessed only for test usage. wait for transaction processed once // WaitTransProcessed only for test usage. wait for transaction processed once
func WaitTransProcessed(gid string) { func WaitTransProcessed(gid string) {
if TransProcessedTestChan == nil {
return
}
logrus.Printf("waiting for gid %s", gid) logrus.Printf("waiting for gid %s", gid)
id := <-TransProcessedTestChan id := <-TransProcessedTestChan
for id != gid { for id != gid {