Added logging to pinpoint issue #5033 (#5034)

This commit is contained in:
raymonddenhaan 2024-03-04 20:02:08 +01:00 committed by GitHub
parent 87428bcafe
commit aa00e37993
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,6 +178,18 @@ public class DefaultWorkflowDefinitionStorePopulator : IWorkflowDefinitionStoreP
workflowDefinition.MaterializerName = materializedWorkflow.MaterializerName;
workflowDefinitionsToSave.Add(workflowDefinition);
// Temporary measure to try and find the root cause of https://github.com/elsa-workflows/elsa-core/issues/5033
var duplicates = workflowDefinitionsToSave.GroupBy(wd => wd.Id)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToList();
if (duplicates.Any())
{
throw new Exception($"Unable to update WorkflowDefinition with ids {string.Join(',', duplicates)} multiple times.");
}
await _workflowDefinitionStore.SaveManyAsync(workflowDefinitionsToSave, cancellationToken);
}