Skip to content

Commit 4f58c7f

Browse files
author
Daniel Gerlag
committed
.
1 parent 1fea082 commit 4f58c7f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/WorkflowCore/Services/WorkflowThread.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ private void RunWorkflows()
6767
workflow = _persistenceStore.GetWorkflowInstance(workflowId).Result;
6868
if (workflow.Status == WorkflowStatus.Runnable)
6969
{
70-
result = _executor.Execute(workflow, _options);
71-
_persistenceStore.PersistWorkflow(workflow).Wait();
70+
try
71+
{
72+
result = _executor.Execute(workflow, _options);
73+
}
74+
finally
75+
{
76+
_persistenceStore.PersistWorkflow(workflow).Wait();
77+
}
7278
}
7379
}
7480
finally

src/providers/WorkflowCore.Persistence.EntityFramework/Services/EntityFrameworkPersistenceProvider.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,14 @@ public async Task MarkEventUnprocessed(string id)
330330

331331
public async Task PersistErrors(IEnumerable<ExecutionError> errors)
332332
{
333-
foreach (var error in errors)
333+
lock (this)
334334
{
335-
Set<PersistedExecutionError>().Add(error.ToPersistable());
335+
foreach (var error in errors)
336+
{
337+
Set<PersistedExecutionError>().Add(error.ToPersistable());
338+
}
339+
SaveChanges();
336340
}
337-
await SaveChangesAsync();
338341
}
339342
}
340343
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously

0 commit comments

Comments
 (0)