Browse Source

use started not toRun

topic
yedf2 5 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() { prepareToCompensate := func() {
toRunActions := pickToRunActions() _ = pickToRunActions() // flag started
for _, b := range toRunActions { for i := 1; i < len(branchResults); i += 2 {
// these branches may have run. so flag them to status succeed, then run the corresponding // these branches may have run. so flag them to status succeed, then run the corresponding
// compensate // 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 { for i, b := range branchResults {
if b.op == dtmcli.BranchCompensate && b.status != dtmcli.StatusSucceed && if b.op == dtmcli.BranchCompensate && b.status != dtmcli.StatusSucceed &&

Loading…
Cancel
Save