Browse Source

use started not toRun

pull/179/head
yedf2 4 years ago
parent
commit
aa8d48183a
  1. 8
      dtmsvr/trans_type_saga.go

8
dtmsvr/trans_type_saga.go

@ -193,11 +193,13 @@ func (t *transSagaProcessor) ProcessOnce(branches []TransBranch) error {
}
}
prepareToCompensate := func() {
toRunActions := pickToRunActions()
for _, b := range toRunActions {
_ = pickToRunActions() // flag started
for i := 1; i < len(branchResults); i += 2 {
// these branches may have run. so flag them to status succeed, then run the corresponding
// compensate
branchResults[b].status = dtmcli.StatusSucceed
if branchResults[i].started && branchResults[i].status == dtmcli.StatusPrepared {
branchResults[i].status = dtmcli.StatusSucceed
}
}
for i, b := range branchResults {
if b.op == dtmcli.BranchCompensate && b.status != dtmcli.StatusSucceed &&

Loading…
Cancel
Save