danielgerlag / danielgerlag/workflow-core

CompensateWithSequence does not execute sequencially with CompensateWith steps.

Open
#1,205 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.9k
Forks
1.3k
Avg merge
1d 1h
Merged PRs (30d)
5

Description

**Describe the bug**
Having a `CompensateWithSequence` step causes the compensation to happen in parallel with `CompensateWith` steps.

**To Reproduce**
Steps to reproduce the behavior:
```csharp
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.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.