CompensateWithSequence does not execute sequencially with CompensateWith steps.
andrei-micuda opened this issue · 0 comments
andrei-micuda commented
Describe the bug
Having a CompensateWithSequence
step causes the compensation to happen in parallel with CompensateWith
steps.
To Reproduce
Steps to reproduce the behavior:
builder.Saga(x => x
.StartWith(_ => Console.WriteLine("Step1."))
.CompensateWith(_ => Console.WriteLine("Compensating Step1."))
.Then(_ => Console.WriteLine("Step2."))
.CompensateWithSequence(seq => seq
.StartWith(_ => Console.WriteLine("Compensating Step2."))
.Then(_ => Thread.Sleep(3000))
.Then(_ => Console.WriteLine("Finished compensating Step2."))
)
.Then(_ => throw new Exception()));
The output of the workflow is:
Step1.
Step2.
Compensating Step1.
Compensating Step2.
Finished compensating Step2.
Expected behavior
The expected output of the workflow is:
Step1.
Step2.
Compensating Step2.
Finished compensating Step2.
Compensating Step1.