diff --git a/dtmcli/message.go b/dtmcli/message.go index f1acb03..9cd5b64 100644 --- a/dtmcli/message.go +++ b/dtmcli/message.go @@ -61,9 +61,5 @@ func (s *Msg) Prepare(queryPrepared string) error { s.QueryPrepared = common.OrString(queryPrepared, s.QueryPrepared) 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)) - rerr := CheckDtmResponse(resp, err) - if rerr != nil { - return rerr - } - return nil + return CheckDtmResponse(resp, err) } diff --git a/dtmsvr/utils.go b/dtmsvr/utils.go index ad87dcd..a552ba2 100644 --- a/dtmsvr/utils.go +++ b/dtmsvr/utils.go @@ -38,6 +38,9 @@ var TransProcessedTestChan chan string = nil // WaitTransProcessed only for test usage. wait for transaction processed once func WaitTransProcessed(gid string) { + if TransProcessedTestChan == nil { + return + } logrus.Printf("waiting for gid %s", gid) id := <-TransProcessedTestChan for id != gid {