File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ func (s *Saga) startSaga() {
60
60
// ExecSub executes a sub-transaction for given subTxID(which define in SEC initialize) and arguments.
61
61
// it returns current Saga.
62
62
func (s * Saga ) ExecSub (subTxID string , args ... interface {}) * Saga {
63
- if s .abortStatus {
63
+ if s .IsAborted () {
64
64
return s
65
65
}
66
66
@@ -100,7 +100,7 @@ func (s *Saga) ExecSub(subTxID string, args ...interface{}) *Saga {
100
100
}
101
101
102
102
// EndSaga finishes a Saga's execution.
103
- func (s * Saga ) EndSaga () {
103
+ func (s * Saga ) EndSaga () * Saga {
104
104
log := & Log {
105
105
Type : SagaEnd ,
106
106
Time : time .Now (),
@@ -113,6 +113,13 @@ func (s *Saga) EndSaga() {
113
113
if err != nil {
114
114
panic ("Clean up topic failure" )
115
115
}
116
+
117
+ return s
118
+ }
119
+
120
+ // IsAborted return status if saga is aborted or not
121
+ func (s * Saga ) IsAborted () bool {
122
+ return s .abortStatus
116
123
}
117
124
118
125
// Abort stop and compensate to rollback to start situation.
You can’t perform that action at this time.
0 commit comments