diff --git a/TEST/App.config b/TEST/App.config
new file mode 100644
index 0000000..b50c74f
--- /dev/null
+++ b/TEST/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TEST/Program.cs b/TEST/Program.cs
new file mode 100644
index 0000000..b72e316
--- /dev/null
+++ b/TEST/Program.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TEST
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ int sec;
+ sec = 55; Console.WriteLine($"*/{(int)(sec / 60)} * * * *");
+ sec = 75; Console.WriteLine($"*/{(int)(sec / 60)} * * * *");
+ sec = 120; Console.WriteLine($"*/{(int)(sec / 60)} * * * *");
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/TEST/Properties/AssemblyInfo.cs b/TEST/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a65411a
--- /dev/null
+++ b/TEST/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TEST")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TEST")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("fa347448-26b1-4c84-a0e4-319744116dd7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/TEST/TEST.csproj b/TEST/TEST.csproj
new file mode 100644
index 0000000..b20df2b
--- /dev/null
+++ b/TEST/TEST.csproj
@@ -0,0 +1,53 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {FA347448-26B1-4C84-A0E4-319744116DD7}
+ Exe
+ TEST
+ TEST
+ v4.6.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Vrh.Web.Reporting.sln b/Vrh.Web.Reporting.sln
index 237fd03..b8d10c1 100644
--- a/Vrh.Web.Reporting.sln
+++ b/Vrh.Web.Reporting.sln
@@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vrh.Web.iScheduler.Report.L
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vrh.Web.Reporting", "Vrh.Web.Reporting\Vrh.Web.Reporting.csproj", "{C0EE2B4C-A281-4C18-BFC7-48427985F732}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TEST", "TEST\TEST.csproj", "{FA347448-26B1-4C84-A0E4-319744116DD7}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -74,6 +76,10 @@ Global
{C0EE2B4C-A281-4C18-BFC7-48427985F732}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0EE2B4C-A281-4C18-BFC7-48427985F732}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0EE2B4C-A281-4C18-BFC7-48427985F732}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA347448-26B1-4C84-A0E4-319744116DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA347448-26B1-4C84-A0E4-319744116DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA347448-26B1-4C84-A0E4-319744116DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA347448-26B1-4C84-A0E4-319744116DD7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Vrh.Web.Reporting/Properties/AssemblyInfo.cs b/Vrh.Web.Reporting/Properties/AssemblyInfo.cs
index ce526b7..a983522 100644
--- a/Vrh.Web.Reporting/Properties/AssemblyInfo.cs
+++ b/Vrh.Web.Reporting/Properties/AssemblyInfo.cs
@@ -36,6 +36,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.2.0")]
-[assembly: AssemblyFileVersion("1.1.2.0")]
-[assembly: AssemblyInformationalVersion("1.1.2")]
+[assembly: AssemblyVersion("1.2.0.0")]
+[assembly: AssemblyFileVersion("1.2.0.0")]
+[assembly: AssemblyInformationalVersion("1.2.0")]
diff --git a/Vrh.Web.Reporting/WebServerHostedServiceStarter.cs b/Vrh.Web.Reporting/WebServerHostedServiceStarter.cs
index d4cdabb..eb167da 100644
--- a/Vrh.Web.Reporting/WebServerHostedServiceStarter.cs
+++ b/Vrh.Web.Reporting/WebServerHostedServiceStarter.cs
@@ -217,27 +217,30 @@ namespace Vrh.Web.WebServerHostedServiceStarterNS
private object ExternalInitializerStarStopLocker = new object();
private static readonly WebServerHostedServiceStarter IISHostedServiceStarterInstance = new WebServerHostedServiceStarter();
private static List> externalinitializerList = new List>();
- private static bool Config_DisablAutoStart
+ #endregion private members
+
+ #region private members - appconfig elements
+ private static bool Config_DisableAutoStart
{
get
{
- if (!config_disablautostart.HasValue)
+ if (!config_disableautostart.HasValue)
{
string disableautostartstring = ConfigurationManager.AppSettings[DISABLEAUTOSTART];
- if (string.IsNullOrWhiteSpace(disableautostartstring)) config_disablautostart = DISABLEAUTOSTARTDEFAULT;
- else if (disableautostartstring.ToLower() == bool.TrueString.ToLower()) config_disablautostart = true;
- else if (disableautostartstring.ToLower() != bool.FalseString.ToLower()) config_disablautostart = false;
- else config_disablautostart = DISABLEAUTOSTARTDEFAULT;
+ if (string.IsNullOrWhiteSpace(disableautostartstring)) config_disableautostart = DISABLEAUTOSTARTDEFAULT;
+ else if (disableautostartstring.ToLower() == bool.TrueString.ToLower()) config_disableautostart = true;
+ else if (disableautostartstring.ToLower() != bool.FalseString.ToLower()) config_disableautostart = false;
+ else config_disableautostart = DISABLEAUTOSTARTDEFAULT;
}
- return config_disablautostart.Value;
+ return config_disableautostart.Value;
}
}
- private static bool? config_disablautostart = null;
- private const string IISHOSTEDSERVICESTARTER = "IISHostedServiceStarter:";
+ private static bool? config_disableautostart = null;
+ private const string IISHOSTEDSERVICESTARTER = "WebServerHostedServiceStarter:";
private const string DISABLEAUTOSTART = IISHOSTEDSERVICESTARTER + "disableautostart";
private const bool DISABLEAUTOSTARTDEFAULT = false;
private const string NOEXTERNALINITIALIZERSAREREGISTERED = "No external initializers are registered!";
- #endregion private members
+ #endregion private members - appconfig elements
#region private method - _SetupAutoStart
///
@@ -302,8 +305,8 @@ namespace Vrh.Web.WebServerHostedServiceStarterNS
le.AddDataField("SetupAutoStart serviceAutoStartProviderTypeFullName", serviceAutoStartProviderTypeFullName);
le.AddDataField("SetupAutoStart serviceAutoStartProviderAssassemblyName", serviceAutoStartProviderAssassemblyName);
- if (!disablemode.HasValue) disablemode = Config_DisablAutoStart;
- le.AddDataField("DisablAautoStart", disablemode.Value);
+ if (!disablemode.HasValue) disablemode = Config_DisableAutoStart;
+ le.AddDataField("DisableautoStart", disablemode.Value);
string filecontent;
bool configchanged;
diff --git a/Vrh.Web.iScheduler.Report.Lib/Areas/iSchedulerReport/Controllers/iSchedulerReportController.cs b/Vrh.Web.iScheduler.Report.Lib/Areas/iSchedulerReport/Controllers/iSchedulerReportController.cs
index 12b7b0f..683cea0 100644
--- a/Vrh.Web.iScheduler.Report.Lib/Areas/iSchedulerReport/Controllers/iSchedulerReportController.cs
+++ b/Vrh.Web.iScheduler.Report.Lib/Areas/iSchedulerReport/Controllers/iSchedulerReportController.cs
@@ -627,7 +627,7 @@ namespace Vrh.Web.iScheduler.Report.Areas.iSchedulerReport.Controllers
try
{
SchedulerPlugin schedulerPlugin = new SchedulerPlugin();
- ReturnInfoJSON ri = schedulerPlugin.TimedTask(
+ ReturnInfoJSON ri = schedulerPlugin.ExecuteScheduledTask(
model.XmlCs,
base.ForcedLanguageCode,
model.PackageName,
@@ -710,7 +710,7 @@ namespace Vrh.Web.iScheduler.Report.Areas.iSchedulerReport.Controllers
OperationId = OperationId ?? (SRConstants.Operations.EXECUTE_KEY); CheckIfParameterIsEmpty(OperationId, "OperationId");
if (String.IsNullOrEmpty(xml)) xml = "???";
- executionmessage = (new SchedulerPlugin()).TimedTask(xml, base.ForcedLanguageCode, ObjectId, OperationId, TimeStamp, GroupId).ReturnMessage;
+ executionmessage = (new SchedulerPlugin()).ExecuteScheduledTask(xml, base.ForcedLanguageCode, ObjectId, OperationId, TimeStamp, GroupId).ReturnMessage;
rijson.ReturnValue = 0;
}
catch (Exception ex)
diff --git a/Vrh.iScheduler.Interface/ISchedulerPlugin.cs b/Vrh.iScheduler.Interface/ISchedulerPlugin.cs
index d767097..af7c49c 100644
--- a/Vrh.iScheduler.Interface/ISchedulerPlugin.cs
+++ b/Vrh.iScheduler.Interface/ISchedulerPlugin.cs
@@ -51,7 +51,7 @@ namespace Vrh.iScheduler.Interfaces
///
/// Egy ReturnInfoJSON objektum a message részében formázott html üzenettel.
///
- ReturnInfoJSON TimedTask(string xml, string lcid, string objectId, string operationId, string timeStamp, string groupId = null);
+ ReturnInfoJSON ExecuteScheduledTask(string xml, string lcid, string objectId, string operationId, string timeStamp, string groupId = null);
///
/// Ütemezendő objektumok létezésének ellenőrzése.
diff --git a/Vrh.iScheduler.Report/SchedulerPlugin.cs b/Vrh.iScheduler.Report/SchedulerPlugin.cs
index ae9989c..9ff34a5 100644
--- a/Vrh.iScheduler.Report/SchedulerPlugin.cs
+++ b/Vrh.iScheduler.Report/SchedulerPlugin.cs
@@ -249,14 +249,14 @@ namespace Vrh.iScheduler.Report
///
/// Egy ReturnInfoJSON objektum a message részében formázott html üzenettel.
///
- public ReturnInfoJSON TimedTask(string xml, string lcid, string objectId, string operationId, string timeStamp, string groupId = null)
+ public ReturnInfoJSON ExecuteScheduledTask(string xml, string lcid, string objectId, string operationId, string timeStamp, string groupId = null)
{
string errorOccured = "Error occured when the TimedTask method is running.";
try
{
#region DEBUG
#if DEBUG
- string thisfn = string.Concat(nameof(SchedulerPlugin), ".", nameof(TimedTask), ": ");
+ string thisfn = string.Concat(nameof(SchedulerPlugin), ".", nameof(ExecuteScheduledTask), ": ");
System.Diagnostics.Debug.WriteLine($"{thisfn}START");
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
diff --git a/Vrh.iScheduler/Monitor .cs b/Vrh.iScheduler/Monitor .cs
index 063ffbb..88b36f3 100644
--- a/Vrh.iScheduler/Monitor .cs
+++ b/Vrh.iScheduler/Monitor .cs
@@ -32,16 +32,18 @@ namespace Vrh.iScheduler
var le = new DCLogEntry(LogLevel.Information, $"{typeof(WAHostedMonitorHangfire).FullName}.{System.Reflection.MethodBase.GetCurrentMethod().Name}");
try
{
- _MonitorHangfireInstance._StartHangfire(le);
- string ischedulerMonitorXml = "config=ALMiSchedulerMonitor";//TODO:hogy lehet ezt paraméterben átadni??????
- string ischedulerXml = ""; // vagy "config=ALMiScheduler;";
- var m_xmlp = new iSchedulerXMLProcessor(ischedulerMonitorXml, ischedulerXml);
- Monitor.SetiSchedulerCommonXMLProcessor(m_xmlp);
- if (m_xmlp.EnableWebAppExecution && m_xmlp.CheckInterval > 0)
+ _StartHangfire(le);
+
+ foreach (string cf in Config_iSchedulerConfigList)
{
- IntervalCronExpression = Cron.MinuteInterval((int)(m_xmlp.CheckInterval / 60));//"*/1 * * * *"
- //RecurringJob.RemoveIfExists("ischedulermonitorcycle");
- RecurringJob.AddOrUpdate("ischedulermonitorcycle", () => new Monitor().Examination(null), IntervalCronExpression);
+ if (!ParseiSchedulerConfigString(cf, out string jobid, out string xmlcs, out int checkintervalinseconds)) { le.AddDataField("Adding iScheduler job", $"iScheduler job definition error, job skipped! definition:{cf}"); continue; };
+ le.AddDataField("Adding iScheduler job", cf);
+
+ IntervalCronExpression = $"*/{(int)(checkintervalinseconds / 60)} * * * *";
+ RecurringJob.AddOrUpdate(jobid, () => Monitor.ExaminationRunOnce(Process.GetCurrentProcess().Id, xmlcs), IntervalCronExpression);
+ //Hangfire.SqlServer.SqlServerStorageOptions.
+ //IntervalCronExpression = Cron.MinuteInterval((int)(m_xmlp.CheckIntervalInSeconds / 60));//"*/1 * * * *"
+ //RecurringJob.RemoveIfExists("ischedulermonitorcycle");
//var HanfireJobId = BackgroundJob.Enqueue(() => new Monitor().Examination(null));
//RecurringJob.AddOrUpdate("ischedulermonitorcycle", () => new Monitor(m_xmlp).Examination(null), intervalcron); //minutes interval
//RecurringJob.AddOrUpdate("ischedulermonitorcycle", () => new Monitor(m_xmlp).Examination(null), $"{(int)(m_xmlp.CheckInterval / 60)} * * * *"); // cron expression
@@ -54,12 +56,12 @@ namespace Vrh.iScheduler
public static void Stop()
{
var le = new DCLogEntry(LogLevel.Information, $"{typeof(WAHostedMonitorHangfire).FullName}.{System.Reflection.MethodBase.GetCurrentMethod().Name}");
- try { _MonitorHangfireInstance._StopHangfire(le); }
+ try { _StopHangfire(le); }
catch (Exception ex) { le.AddExceptionResult(ex); le.SetLogLevel(LogLevel.Error); }
finally { le.Write(); }
}
-
+ #region private members - Cron expression
///
/// Cron Expression
///
@@ -143,15 +145,10 @@ namespace Vrh.iScheduler
/// At Every 4 Months at 6am on the 10th: "0 06 10 */4 *"
///
private static string IntervalCronExpression = null;
- private static WAHostedMonitorHangfire _MonitorHangfireInstance = new WAHostedMonitorHangfire();
+ #endregion private members - Cron expression
- private BackgroundJobServer _HangfireBackgroundJobServer { get; set; }
- private static readonly object _HangfireStarterLocker = new object();
- private static bool _HangFireRunning = false;
- const string HANGFIRE = "HangfireBootstrapper:";
- const string HANGFIREDBCONNECTIONSTRING = HANGFIRE + "dbconnectionstring";
- const string HANGFIRESQLDBCONNECTIONSTRINGNAMEDEFAULT = "HANGFIRESQLDB";
- private void _StartHangfire(DCLogEntry le)
+ #region private members - _StartHangfire,_StopHangfire
+ private static void _StartHangfire(DCLogEntry le)
{
lock (_HangfireStarterLocker)
{
@@ -165,7 +162,7 @@ namespace Vrh.iScheduler
_HangFireRunning = true;
}
}
- private void _StopHangfire(DCLogEntry le)
+ private static void _StopHangfire(DCLogEntry le)
{
lock (_HangfireStarterLocker)
{
@@ -175,20 +172,59 @@ namespace Vrh.iScheduler
_HangFireRunning = false;
}
}
- private string Config_HangFireConnectionString
+ //private static WAHostedMonitorHangfire _MonitorHangfireInstance = new WAHostedMonitorHangfire();
+ private static BackgroundJobServer _HangfireBackgroundJobServer { get; set; }
+ private static readonly object _HangfireStarterLocker = new object();
+ private static bool _HangFireRunning = false;
+ #endregion private members - _StartHangfire,_StopHangfire
+
+ #region appconfig elements
+ const string WSHSHANGFIRE = "WebServerHostedService_iSchedulerHangfire:";
+ const string HANGFIREDBCONNECTIONSTRING = WSHSHANGFIRE + "dbconnectionstring";
+ const string HANGFIRECONFIGLIST = WSHSHANGFIRE + "configlist";
+ private static List Config_iSchedulerConfigList
+ {
+ get
+ {
+ if (config_ischedulerconfiglist == null)
+ {
+ string configliststring = ConfigurationManager.AppSettings[HANGFIRECONFIGLIST];
+ if (string.IsNullOrWhiteSpace(configliststring)) configliststring = "";
+ config_ischedulerconfiglist = configliststring.Split(new char[] { ',', ';' },StringSplitOptions.RemoveEmptyEntries).ToList();
+ }
+ return config_ischedulerconfiglist;
+ }
+ }
+ private static List config_ischedulerconfiglist = null;
+ private static bool ParseiSchedulerConfigString(string cf, out string jobid, out string xmlcs, out int checkintervalinseconds)
+ {
+ jobid = "";xmlcs = ""; checkintervalinseconds = 60;
+ if (string.IsNullOrWhiteSpace(cf)) return false;
+ try
+ {
+ jobid = cf.Split(':')[0];
+ xmlcs = cf.Split(':')[1];
+ checkintervalinseconds = int.Parse(cf.Split(':')[2]);
+ }
+ catch { }
+ if (checkintervalinseconds < 60) checkintervalinseconds = 60;
+ return !string.IsNullOrWhiteSpace(jobid) && !string.IsNullOrWhiteSpace(xmlcs) && checkintervalinseconds >= 60;
+ }
+ private static string Config_HangFireConnectionString
{
get
{
if (config_hangfireconnectionstring == null)
{
string HangfireSqlDBConnectionString = ConfigurationManager.AppSettings[HANGFIREDBCONNECTIONSTRING];
- if (string.IsNullOrWhiteSpace(HangfireSqlDBConnectionString)) HangfireSqlDBConnectionString = HANGFIRESQLDBCONNECTIONSTRINGNAMEDEFAULT;
+ if (string.IsNullOrWhiteSpace(HangfireSqlDBConnectionString)) HangfireSqlDBConnectionString = "HANGFIRESQLDB";
config_hangfireconnectionstring = ConnectionStringStore.GetSQL(HangfireSqlDBConnectionString);
}
return config_hangfireconnectionstring;
}
}
- private string config_hangfireconnectionstring = null;
+ private static string config_hangfireconnectionstring = null;
+ #endregion appconfig elements
}
}
namespace Vrh.iScheduler
@@ -273,12 +309,7 @@ namespace Vrh.iScheduler
#region Private members
private Timer m_timer;
- private iSchedulerXMLProcessor m_xmlp;
- private static iSchedulerXMLProcessor CommonM_xmlp;
- public static void SetiSchedulerCommonXMLProcessor(iSchedulerXMLProcessor m_xmlp)
- {
- CommonM_xmlp = m_xmlp;
- }
+ private iSchedulerXMLProcessor m_xmlp=null;
#endregion Private members
#region Constructor
@@ -290,32 +321,26 @@ namespace Vrh.iScheduler
/// ScheduleExecute akció által használt iScheduler.xml elérési helye a névvel együtt
/// Az indító plugin példányra mutató referencia
/// a távoli gépen. Ha egy gépen fut, akkor nem kötelező.
- public Monitor(string scheduleMonitorXmlPath, string scheduleXmlPath)
- {
- Init(new iSchedulerXMLProcessor(scheduleMonitorXmlPath, scheduleXmlPath));
- }
- public Monitor(iSchedulerXMLProcessor m_xmlp)
- {
- Init(m_xmlp);
- }
- public Monitor()
- {
- Init(CommonM_xmlp);
- }
- private void Init(iSchedulerXMLProcessor m_xmlp)
+ public Monitor(string scheduleMonitorXmlPath, string scheduleXmlPath) { Init(new iSchedulerXMLProcessor(scheduleMonitorXmlPath, scheduleXmlPath)); }
+ public Monitor(iSchedulerXMLProcessor m_xmlp) { Init(m_xmlp); }
+ public Monitor() { }
+ private void Init(iSchedulerXMLProcessor m_xmlp,bool enabletimer=true)
{
this.m_xmlp = m_xmlp;
//try
//{
- m_timer = new Timer(m_xmlp.CheckInterval * 1000); // !!! Ez itt a jó sor !!! m_timer = new Timer(20000); meg a debug !!!
- m_timer.Elapsed += OnExamination;
+ if (!enabletimer)
+ {
+ m_timer = new Timer(m_xmlp.CheckIntervalInSeconds * 1000); // !!! Ez itt a jó sor !!! m_timer = new Timer(20000); meg a debug !!!
+ m_timer.Elapsed += OnExamination;
+ }
var le = new DCLogEntry(LogLevel.Information, nameof(Monitor) + " constructor. Preparation ready.");
le.AddDataField("iSchedulerMonitor xml path", m_xmlp.ScheduleMonitorXmlPath);
le.AddDataField("iScheduler xml path", m_xmlp.ScheduleXmlPath);
le.AddDataField("Scheduled object type", m_xmlp.ObjectType);
le.AddDataField("Group Id", m_xmlp.GroupId);
- le.AddDataField("Check interval", m_xmlp.CheckInterval.ToString());
+ le.AddDataField("Check interval", m_xmlp.CheckIntervalInSeconds.ToString());
le.Write();
//}
@@ -346,7 +371,7 @@ namespace Vrh.iScheduler
private void OnExamination(object sender, ElapsedEventArgs e)
{
m_timer.Stop();
- Examination(e.SignalTime);
+ Examination(e.SignalTime,null);
m_timer.Start();
}
@@ -356,23 +381,25 @@ namespace Vrh.iScheduler
///
///
[DisableConcurrentExecution(1000)]
- public void Examination(DateTime? signalTime)
+ public void Examination(DateTime? signalTime,DCLogEntry le)
{
- var le = new DCLogEntry(LogLevel.Debug,nameof(Examination));
+ bool writele = false;
+ if (le == null) { le = new DCLogEntry(LogLevel.Debug, nameof(Examination)); writele = true; }
if (!signalTime.HasValue) signalTime = DateTime.Now;
try
{
using (SqlConnection cnn = new SqlConnection(m_xmlp.DatabaseConnectionString))
{
cnn.Open();
- le.AddDataField("Database connection opened", $"Connection string: {m_xmlp.DatabaseConnectionString}");
+ le.AddDataField($"{nameof(Examination)}: Database connection opened", $"Connection string: {m_xmlp.DatabaseConnectionString}");
string scmd = string.Concat(
" select *",
" from iScheduler.Schedules s",
" inner join iScheduler.ScheduleObjects so on s.ScheduleObjectId = so.Id",
" where s.[State] = 0 and s.OperationTime < @signalTime",
- " and so.ObjectType = @objectType and so.ObjectGroupId = @groupId");
+ " and so.ObjectType = @objectType and so.ObjectGroupId = @groupId"
+ );
using (SqlCommand cmd = new SqlCommand(scmd, cnn))
{
cmd.Parameters.Add(new SqlParameter("signalTime", signalTime));
@@ -395,13 +422,13 @@ namespace Vrh.iScheduler
ScheduledJobCounter++;
int id = rdr.GetInt32(ixID);
DateTime jobstartedat = DateTime.Now;
- le.AddDataField($"Scheduled job #{ScheduledJobCounter} started", $"id={id}");
+ le.AddDataField($"{nameof(Examination)}: Scheduled job #{ScheduledJobCounter} started", $"id={id}");
se.Run(id);
- le.AddDataField($"Scheduled job #{ScheduledJobCounter} finished at", (DateTime.Now).Subtract(jobstartedat).ToString(@"hh\:mm\:ss"));
- le.AddSuccessResult("Scheduled job execution SUCCESS");
+ le.AddDataField($"{nameof(Examination)}: Scheduled job #{ScheduledJobCounter} finished at", (DateTime.Now).Subtract(jobstartedat).ToString(@"hh\:mm\:ss"));
+ le.AddSuccessResult($"{nameof(Examination)}: Scheduled job execution SUCCESS");
}//while (rdr.Read())
}//if (rdr.HasRows)
- else { le.AddSuccessResult($"No scheduled job found!"); }
+ else { le.AddSuccessResult($"{nameof(Examination)}: No scheduled job found!"); }
}
}
}
@@ -410,6 +437,13 @@ namespace Vrh.iScheduler
le.SetLogLevel(LogLevel.Error);
le.AddExceptionResult(ex);
}
+ finally { if (writele) le.Write(); }
+ }
+ public static void ExaminationRunOnce(int pid, string xmlcs)
+ {
+ var le = new DCLogEntry(LogLevel.Debug, nameof(ExaminationRunOnce));
+ try { (new Monitor(xmlcs, "")).Examination(null, le); }
+ catch (Exception ex) { le.AddExceptionResult(ex); }
finally { le.Write(); }
}
#endregion Examination
diff --git a/Vrh.iScheduler/ScheduleExecute.cs b/Vrh.iScheduler/ScheduleExecute.cs
index 96abecd..7c5ed0b 100644
--- a/Vrh.iScheduler/ScheduleExecute.cs
+++ b/Vrh.iScheduler/ScheduleExecute.cs
@@ -164,7 +164,7 @@ namespace Vrh.iScheduler
#region Plugin elérési mód esetén
try
{
- rijson = this.Plugin.TimedTask(
+ rijson = this.Plugin.ExecuteScheduledTask(
this.Scheduler.Plugin.ObjectXml,
this.Scheduler.LCID,
sch.ScheduleObject.ObjectId,
diff --git a/Vrh.iScheduler/iSchedulerXMLProcessor.cs b/Vrh.iScheduler/iSchedulerXMLProcessor.cs
index 601ef39..a9a08db 100644
--- a/Vrh.iScheduler/iSchedulerXMLProcessor.cs
+++ b/Vrh.iScheduler/iSchedulerXMLProcessor.cs
@@ -126,7 +126,7 @@ namespace Vrh.iScheduler
/// Minimum: 60 sec (1perc), maximum: 86400 sec (1nap).
/// Ha a tulajdonság nem létezik, vagy értelmezhetetlen, akkor a minimum lesz.
///
- public int CheckInterval
+ public int CheckIntervalInSeconds
{
get
{
--
libgit2 0.21.2