MS Jobrunner only start when job exists

This commit is contained in:
Developer01
2024-10-11 08:40:00 +02:00
parent b81ac40139
commit 8a208993d9
7 changed files with 34 additions and 31 deletions

View File

@@ -66,7 +66,7 @@ Public Class JobRunner
{"MSSQL", _mssql},
{"Args", oJobConfig.Args}
}
Dim oCountGraphJobs As Int16 = 0
Dim oJob = JobBuilder.Create(Of T)().
WithIdentity(oJobIdentity).
UsingJobData(oJobData).
@@ -82,12 +82,13 @@ Public Class JobRunner
Await _scheduler.ScheduleJob(oJob, oTrigger)
_Logger.Info("Job {0} scheduled.", JobName)
oCountGraphJobs += 1
Else
_Logger.Info("Job {0} is disabled.", JobName)
End If
' If StartWithoutDelay is True, start Job after 10 Seconds
If oJobConfig.StartWithoutDelay Then
If oJobConfig.StartWithoutDelay And oCountGraphJobs > 0 Then
Dim oDebugJob = JobBuilder.Create(Of T)().
WithIdentity(oJobIdentity & "-DEBUG").
UsingJobData(oJobData).
@@ -100,6 +101,10 @@ Public Class JobRunner
_Logger.Info("Job {0} will start in 10 Seconds.", JobName)
Await _scheduler.ScheduleJob(oDebugJob, oDebugTrigger)
Else
If oCountGraphJobs = 0 Then
_Logger.Info("No Jobs configured!!")
End If
End If
End Function