diff --git a/dtmsvr/api.go b/dtmsvr/api.go index beb5d46..8060fe1 100644 --- a/dtmsvr/api.go +++ b/dtmsvr/api.go @@ -42,6 +42,7 @@ func svcAbort(t *TransGlobal) (interface{}, error) { if t.TransType != "xa" && t.TransType != "tcc" || dbt.Status != dtmcli.StatusPrepared && dbt.Status != dtmcli.StatusAborting { return M{"dtm_result": dtmcli.ResultFailure, "message": fmt.Sprintf("trans type: '%s' current status '%s', cannot abort", dbt.TransType, dbt.Status)}, nil } + dbt.changeStatus(db, dtmcli.StatusAborting) return dbt.Process(db), nil } diff --git a/dtmsvr/trans.go b/dtmsvr/trans.go index f1b0687..388898c 100644 --- a/dtmsvr/trans.go +++ b/dtmsvr/trans.go @@ -77,7 +77,7 @@ func (t *TransGlobal) changeStatus(db *common.DB, status string) *gorm.DB { func (t *TransGlobal) isTimeout() bool { timeout := t.TimeoutToFail - if t.TimeoutToFail == 0 && t.TransType != "saga" && t.TransType != "msg" { + if t.TimeoutToFail == 0 && t.TransType != "saga" { timeout = config.TimeoutToFail } if timeout == 0 { diff --git a/test/barrier_tcc_test.go b/test/barrier_tcc_test.go index 8bb656b..8b358a4 100644 --- a/test/barrier_tcc_test.go +++ b/test/barrier_tcc_test.go @@ -102,10 +102,10 @@ func tccBarrierDisorder(t *testing.T) { finishedChan <- "1" }() dtmcli.Logf("cron to timeout and then call cancel") - go CronTransOnce() + go cronTransOnceForwardNow(300) time.Sleep(100 * time.Millisecond) dtmcli.Logf("cron to timeout and then call cancelled twice") - CronTransOnce() + cronTransOnceForwardNow(300) timeoutChan <- "wake" timeoutChan <- "wake" <-finishedChan