20-12-2022

This commit is contained in:
Jonathan Jenne
2022-12-20 15:29:29 +01:00
parent 3e2c4a9ab0
commit 1e925242bc
12 changed files with 291 additions and 179 deletions

View File

@@ -47,16 +47,26 @@ Public Class JobStatus
Logger.Info("Completing Job [{0}] with Error", oStatus.Id)
If oStatus IsNot Nothing Then
oStatus.ProgressCurrent = oStatus.ProgressTotal
oStatus.ExecutionTime = pJob.JobRunTime
oStatus.Executing = False
oStatus.CompleteTime = Date.Now
oStatus.FailureMessage = pMessage
oStatus.Successful = False
oStatus.Steps = pSteps
oStatus.Waiting = False
End If
Return oStatus
Return DoComplete(pJob, pSteps)
End Function
Public Function CompleteWithWaiting(pJob As Quartz.IJobExecutionContext, pSteps As List(Of StatusItem.HistoryStep), pMessage As String) As StatusItem
Dim oStatus = GetJobStatus(pJob)
Logger.Info("Completing Job [{0}] with Waiting", oStatus.Id)
If oStatus IsNot Nothing Then
oStatus.SuccessMessage = pMessage
oStatus.Successful = True
oStatus.Waiting = True
End If
Return DoComplete(pJob, pSteps)
End Function
Public Function CompleteWithSuccess(pJob As Quartz.IJobExecutionContext, pSteps As List(Of StatusItem.HistoryStep), pMessage As String) As StatusItem
@@ -65,23 +75,35 @@ Public Class JobStatus
Logger.Info("Completing Job [{0}] with Success", oStatus.Id)
If oStatus IsNot Nothing Then
oStatus.ProgressCurrent = oStatus.ProgressTotal
oStatus.ExecutionTime = pJob.JobRunTime
oStatus.Executing = False
oStatus.CompleteTime = Date.Now
oStatus.SuccessMessage = pMessage
oStatus.Successful = False
oStatus.Steps = pSteps
oStatus.Successful = True
oStatus.Waiting = False
End If
Return DoComplete(pJob, pSteps)
End Function
Private Function DoComplete(pJob As Quartz.IJobExecutionContext, pSteps As List(Of StatusItem.HistoryStep))
Dim oStatus = GetJobStatus(pJob)
oStatus.ProgressCurrent = oStatus.ProgressTotal
oStatus.ExecutionTime = pJob.JobRunTime
oStatus.Executing = False
oStatus.CompleteTime = Date.Now
oStatus.Steps = pSteps
Return oStatus
End Function
Private Function GetJobStatus(pJob As Quartz.IJobExecutionContext) As StatusItem
Dim oJobId = GetJobId(pJob)
Dim oJobId As String = GetJobId(pJob)
Logger.Debug("Getting status for job id [{0}]", oJobId)
Dim oExists = Entries.Where(Function(e) e.JobId = oJobId).Any()
Logger.Debug("Job exists: [{0}]", oExists)
If Not oExists Then
Logger.Debug("Creating status for job id [{0}]", oJobId)
Entries.Add(New StatusItem With {
.JobId = oJobId,
.Id = Guid.NewGuid.ToString(),
@@ -89,7 +111,7 @@ Public Class JobStatus
})
End If
Return Entries.Where(Function(e) e.Id = oJobId).SingleOrDefault()
Return Entries.Where(Function(e) e.JobId = oJobId).Single()
End Function
Private Function GetJobId(pJob As Quartz.IJobExecutionContext) As String