fix:修复因使用Task.Run丢失的预警处理异常上报

This commit is contained in:
hardstylewyl 2025-05-06 15:50:05 +08:00
parent be25b8e10d
commit c163a3bcc7
6 changed files with 31 additions and 1 deletions

View File

@ -129,6 +129,10 @@ public class TrackChangeAfterUpdateOrderEventHandler : ITransientDependency, ICa
var handler = scope.ServiceProvider.GetRequiredService<IOrderWarningHandler>();
await handler.HandleOrderDeletedOrCompletedAsync(order);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
scope.Dispose();

View File

@ -383,6 +383,10 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
await handler2.TrackDeletedHandleAsync(signals);
await handler3.TrackUpdatedOrDeletedHandleAsync(signals);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
await scope.DisposeAsync();

View File

@ -525,6 +525,10 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
await handler.TrackAddedHandleAsync(signals);
await handler2.TrackAddedOrUpdatedHandleAsync(signals);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
await scope.DisposeAsync();
@ -549,6 +553,10 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
await handler.TrackAddedOrUpdatedHandleAsync(signals);
await handler2.TrackUpdatedOrDeletedHandleAsync(signals);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
await scope.DisposeAsync();

View File

@ -1,4 +1,5 @@
using DotNetCore.CAP;
using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Services.ProvideServices;
@ -206,6 +207,10 @@ public partial class OrderService : ApplicationService, IOrderService
var handler = scope.ServiceProvider.GetRequiredService<IOrderWarningHandler>();
await handler.HandleOrderDeletedOrCompletedAsync(order);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
await scope.DisposeAsync();

View File

@ -1,4 +1,5 @@
using System.Linq.Expressions;
using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.AliyunOSS;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
@ -365,6 +366,10 @@ public class TrackOrderService : ApplicationService
var handler = scope.ServiceProvider.GetRequiredService<IOrderWarningHandler>();
await handler.HandleOrderDeletedOrCompletedAsync(order);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
await scope.DisposeAsync();

View File

@ -1,6 +1,7 @@
using System.Linq.Expressions;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Services;
@ -8,7 +9,6 @@ using SJZY.Track.Application.Localization;
using SJZY.Track.Application.Services.Warning.Handlers;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Aggregates.WarningAggregate.Signals;
using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPush;
using Volo.Abp.DependencyInjection;
@ -331,6 +331,10 @@ public class TrackPushService : ApplicationService, ISingletonDependency
var handler = scope.ServiceProvider.GetRequiredService<IReturnWarningHandler>();
await handler.PushConfigChangedHandleAsync(pushConfig, contentConfigEntity);
}
catch (Exception ex)
{
LogHelper.Error(ex);
}
finally
{
scope.Dispose();