fixed status running task & remove re-start scheduling from controller(add field lastfinish - update sql)

This commit is contained in:
vfedosevich 2013-05-15 20:43:41 +03:00
parent c443d94ac3
commit 59b097b10b
6 changed files with 389 additions and 11 deletions

View file

@ -58,13 +58,15 @@ namespace WebsitePanel.EnterpriseServer
public static bool IsScheduleActive(int scheduleId)
{
Dictionary<int, BackgroundTask> scheduledTasks = TaskManager.GetScheduledTasks();
return scheduledTasks.ContainsKey(scheduleId);
ScheduleInfo scheduleInfo = SchedulerController.GetSchedule(scheduleId);
return scheduledTasks.ContainsKey(scheduleId) || scheduleInfo.LastRun > scheduleInfo.LastFinish;
}
public static void StartSchedule(SchedulerJob schedule)
{
Dictionary<int, BackgroundTask> scheduledTasks = TaskManager.GetScheduledTasks();
if (scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId))
if (IsScheduleActive(schedule.ScheduleInfo.ScheduleId))
return;
// run schedule
@ -125,8 +127,6 @@ namespace WebsitePanel.EnterpriseServer
static void RunSchedule(SchedulerJob schedule, bool changeNextRun)
{
try
{
// update next run (if required)