elsa-workflows / elsa-workflows/elsa-core
Resuming a workflow immediately after suspension does nothing.
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Description
I have a workflow that completes an activity, sends a notification to the client, suspends the workflow, and waits for user interaction to resume.
I've noticed a strange behavior: if the user interaction happens immediately after the workflow suspension, resuming the workflow does nothing. No errors, but subsequent activities don’t execute.
This only occurs with a database backend; in-memory workflows work fine. Adding a 10-second delay before resumption fixes the issue. Could this be due to data read/write latency?
Suspension Activity
```csharp
public class SuspendWorkflowActivity : Activity
{
protected override void Execute(ActivityExecutionContext context)
{
// Create a bookmark. The created bookmark will be stored in the workflow state.
var bookmark = context.CreateBookmark();
var test = bookmark.Id;
// This activity does not complete until the event occurs.
}
}
```
Resuming the Workflow
```csharp
var bookmarkQueueItem = new NewBookmarkQueueItem() { BookmarkId = bookmark.Id, Options = new ResumeBookmarkOptions { Input = workflowInput} };
await bookmarkQueue.EnqueueAsync(bookmarkQueueItem);
```
If I add await Task.Delay(10000); before resuming the workflow, everything works fine. The issue occurs only when resuming the workflow immediately after suspension, and only when using a database backend.
Contributor guide
Assessment
This issue has not been assessed yet.