entity change event
Adding over a thousand pieces of data took 30,000 milliseconds?
I don't quite understand the logic here. Is there a setting to turn it off?
public class Assf : UnitOfWork
{
public Assf(IServiceProvider serviceProvider, IOptions<AbpUnitOfWorkDefaultOptions> options):base(serviceProvider, options)
{
}
#region Overrides of UnitOfWork
protected override async Task OnCompletedAsync()
{
foreach (var handler in CompletedHandlers)
{
Stopwatch cw = new Stopwatch();
cw.Start();
await handler.Invoke();
cw.Stop();
var ss = cw.ElapsedMilliseconds;
if (ss>30000)
{
}
}
}
#endregion
}
abp version:3.3.2
hi
You can override the EntityChangeEventHelper to skip some events for your insert operators.
https://github.com/abpframework/abp/blob/a2cbdb41480d1faa018ef5ec3cb34b2cc1084b3d/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs#L22
Yes, I have already reviewed the source code for this part. It seems to be collecting a series of events within the work unit. What I am more concerned about is that the methods registered in OnComplete are triggered when the work unit is finished. The event publishing process can be optimized for specific events,
->LocalEventBus : EventBusBase, ILocalEventBus, ISingletonDependency
if (isFirstEvent)
{
currentUow.OnCompleted(
async () =>
{
foreach (var eventEntry in eventList)
{
try
{
await eventEntry.EventBus.PublishAsync(
eventEntry.EventType,
Activator.CreateInstance(eventEntry.EventType, eventEntry.EntityOrEto)
);
}
catch (Exception ex)
{
Logger.LogError(
$"Caught an exception while publishing the event '{eventType.FullName}' for the entity '{entityOrEto}'");
Logger.LogException(ex);
}
}
}
);
}