Merge pull request #1150 from osavoskin/domain_events_handling_concurrency_issue_fix

A tiny fix of the issue #1121
This commit is contained in:
Miguel Veloso 2019-10-30 15:17:56 +00:00 committed by GitHub
commit 82c56b2cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,12 +21,8 @@ namespace Ordering.Infrastructure
domainEntities.ToList()
.ForEach(entity => entity.Entity.ClearDomainEvents());
var tasks = domainEvents
.Select(async (domainEvent) => {
await mediator.Publish(domainEvent);
});
await Task.WhenAll(tasks);
foreach (var domainEvent in domainEvents)
await mediator.Publish(domainEvent);
}
}
}