Change events args
This commit is contained in:
@ -5,7 +5,6 @@ using Hcs.WebApp.BackgroundServices.OperationExecutors;
|
||||
using Hcs.WebApp.Config;
|
||||
using Hcs.WebApp.Services;
|
||||
using Hcs.WebApp.Utils;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices
|
||||
{
|
||||
@ -40,25 +39,28 @@ namespace Hcs.WebApp.BackgroundServices
|
||||
var messageGuid = string.Empty;
|
||||
try
|
||||
{
|
||||
var startedAt = DateTime.UtcNow;
|
||||
await headquartersService.SetOperationStartedAsync(operation.Id, startedAt);
|
||||
|
||||
state.InvokeOnOperationStarted(operation.Id, operation.CampaignId, startedAt);
|
||||
|
||||
var executor = executorFactory.CreateExecutor(scope, client, operation);
|
||||
await headquartersService.SetOperationStartedAsync(operation.Id);
|
||||
|
||||
state.InvokeOnOperationStarted(operation);
|
||||
|
||||
messageGuid = await executor.ExecuteAsync(stoppingToken);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await headquartersService.SetOperationEndedWithFailAsync(operation.Id, e.CombineMessages());
|
||||
var endedAt = DateTime.UtcNow;
|
||||
var failureReason = e.CombineMessages();
|
||||
await headquartersService.SetOperationEndedWithFailAsync(operation.Id, endedAt, failureReason);
|
||||
|
||||
state.InvokeOnOperationEnded(operation);
|
||||
state.InvokeOnOperationEnded(operation.Id, operation.CampaignId, endedAt, failureReason);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(messageGuid))
|
||||
{
|
||||
await headquartersService.SetOperationMessageGuidAsync(operation.Id, messageGuid);
|
||||
|
||||
state.InvokeOnOperationExecuted(operation);
|
||||
state.InvokeOnOperationExecuted(operation.Id, operation.CampaignId, messageGuid);
|
||||
}
|
||||
|
||||
state.UnsetProcessingOperation(operation);
|
||||
|
||||
Reference in New Issue
Block a user