This commit is contained in:
Virtuworks 2013-03-04 22:15:42 -05:00
commit 0a404d49c1
10 changed files with 197 additions and 21 deletions

View file

@ -2132,6 +2132,7 @@ namespace WebsitePanel.EnterpriseServer
catch(Exception ex)
{
TaskManager.WriteError(ex);
res.IsSuccess = false;
}
return res;
}

View file

@ -33,6 +33,7 @@ using System.Collections;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
namespace WebsitePanel.EnterpriseServer
{
@ -145,8 +146,23 @@ namespace WebsitePanel.EnterpriseServer
schedule.ScheduleInfo.LastRun = DateTime.Now;
// update schedule
SchedulerController.UpdateSchedule(schedule.ScheduleInfo);
int MAX_RETRY_COUNT = 10;
int counter = 0;
while (counter < MAX_RETRY_COUNT)
{
try
{
SchedulerController.UpdateSchedule(schedule.ScheduleInfo);
break;
}
catch (SqlException)
{
System.Threading.Thread.Sleep(1000);
}
counter++;
}
{
// skip execution if the current task is still running
scheduledTasks = TaskManager.GetScheduledTasks();
if (!scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId))
@ -161,7 +177,7 @@ namespace WebsitePanel.EnterpriseServer
{
TaskManager.WriteError(string.Format("RunSchedule Error : {0}", Ex.Message));
}
catch (Exception)
catch(Exception)
{
}
}

View file

@ -150,8 +150,8 @@ namespace WebsitePanel.EnterpriseServer
{
// ERROR
WriteLogRecord(2, ex.Message, ex.StackTrace);
return new Exception(String.Format("Error executing '{0}' task on '{1}' {2}",
TopTask.TaskName, TopTask.ItemName, TopTask.Source), ex);
return new Exception((TopTask != null) ? String.Format("Error executing '{0}' task on '{1}' {2}",
TopTask.TaskName, TopTask.ItemName, TopTask.Source) : String.Format("Error executing task"), ex);
}
public static void WriteError(Exception ex, string text, params string[] textParameters)
@ -182,12 +182,15 @@ namespace WebsitePanel.EnterpriseServer
logRecord.TextParameters = textParameters;
logRecord.TextIdent = TasksStack.Count - 1;
logRecord.ExceptionStackTrace = stackTrace;
RootTask.LogRecords.Add(logRecord);
RootTask.LastLogRecord = logRecord;
if (RootTask != null)
{
RootTask.LogRecords.Add(logRecord);
RootTask.LastLogRecord = logRecord;
// change entire task severity
if (severity > RootTask.Severity)
RootTask.Severity = severity;
// change entire task severity
if (severity > RootTask.Severity)
RootTask.Severity = severity;
}
}
public static void CompleteTask()

View file

@ -46,7 +46,12 @@ namespace WebsitePanel.EnterpriseServer
protected void Application_Start(object sender, EventArgs e)
{
Scheduler.Start();
if (ConfigurationManager.AppSettings["WebsitePanel.DistableScheduler"] != null)
if (Boolean.Parse(ConfigurationManager.AppSettings["WebsitePanel.DistableScheduler"]) == false)
{
if (Scheduler.nextSchedule == null)
Scheduler.Start();
}
}
protected void Application_End(object sender, EventArgs e)

View file

@ -18,9 +18,6 @@
<!-- Maximum waiting time when sending request to the remote server
The value is in seconds. "-1" - infinite. -->
<add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600" />
<!-- Alternative connection string, pulls the value from registry -->
<add key="WebsitePanel.AltConnectionString" value="ConnectionString" />
<add key="WebsitePanel.AltCryptoKey" value="CryptoKey" />
</appSettings>
<system.web>
<!-- Disable any authentication -->