Browse Source
Merge pull request #276 from dtm-labs/alpha
fix TimeoutToFail compensate
pull/281/head
yedf2
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
1 deletions
-
dtmsvr/trans_type_saga.go
-
test/saga_options_test.go
|
|
|
@ -187,7 +187,10 @@ func (t *transSagaProcessor) ProcessOnce(branches []TransBranch) error { |
|
|
|
} |
|
|
|
} |
|
|
|
prepareToCompensate := func() { |
|
|
|
_ = pickToRunActions() // flag started
|
|
|
|
toRun := pickToRunActions() |
|
|
|
for _, b := range toRun { // flag started
|
|
|
|
branchResults[b].started = true |
|
|
|
} |
|
|
|
for i := 1; i < len(branchResults); i += 2 { |
|
|
|
// these branches may have run. so flag them to status succeed, then run the corresponding
|
|
|
|
// compensate
|
|
|
|
|
|
|
|
@ -55,6 +55,7 @@ func TestSagaOptionsTimeout(t *testing.T) { |
|
|
|
assert.Equal(t, StatusSubmitted, getTransStatus(saga.Gid)) |
|
|
|
cronTransOnceForwardNow(t, gid, 3600) |
|
|
|
assert.Equal(t, StatusFailed, getTransStatus(saga.Gid)) |
|
|
|
assert.Equal(t, []string{StatusSucceed, StatusPrepared, StatusPrepared, StatusPrepared}, getBranchesStatus(saga.Gid)) |
|
|
|
} |
|
|
|
|
|
|
|
func TestSagaGlobalTransWithRequestTimeout(t *testing.T) { |
|
|
|
|