diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs index 8df2c33..8f66913 100644 --- a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs @@ -72,7 +72,7 @@ namespace LCU.Api.Internal.Dispatcher.Services.DispatcherOperationServices } else { - await _queueSendErroredJobAlertService.QueueSendErroredJobAlert(job, workItem); + await _queueSendErroredJobAlertService.QueueSendErroredJobAlert(updatedJob, workItem); } } catch (ServiceException serviceException) diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobRepository.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobRepository.cs index 09c0368..09194d1 100644 --- a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobRepository.cs +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobRepository.cs @@ -145,6 +145,7 @@ public class JobRepository : BaseRepository, IJobRepository public async Task Update(Job job) { var trackedJob = await _context.Jobs + .IncludeErrorRecipients() .FirstAsync(j => j.JobId == job.JobId); _context.Entry(trackedJob).CurrentValues.SetValues(job); @@ -156,4 +157,4 @@ public class JobRepository : BaseRepository, IJobRepository { _context.Jobs.Remove(job); } -} \ No newline at end of file +} diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs index 385a333..993430e 100644 --- a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs @@ -35,7 +35,7 @@ public class JobFailureServiceTest } [Fact] - public async Task HandleJobFailureRequest_QueuesErroredJobAlert_WithOriginalJobErrorRecipients() + public async Task HandleJobFailureRequest_QueuesErroredJobAlert_WithUpdatedJobErrorRecipients() { var workItemExecution = new WorkItemExecution { @@ -64,7 +64,10 @@ public class JobFailureServiceTest { JobId = 22, JobStatus = JobStatus.Failed, - JobErrorRecipients = new List() + JobErrorRecipients = new List + { + new JobErrorRecipient { Recipient = "ops@landmarkcu.com" } + } }; var request = new JobFailureRequest { @@ -82,7 +85,7 @@ public class JobFailureServiceTest _mockQueueSendErroredJobAlertService.Verify(x => x.QueueSendErroredJobAlert( It.Is(queuedJob => - queuedJob.JobId == job.JobId && + queuedJob.JobId == updatedJob.JobId && queuedJob.JobStatus == JobStatus.Failed && queuedJob.JobErrorRecipients.Count == 1 && queuedJob.JobErrorRecipients.First().Recipient == "ops@landmarkcu.com"),