public static void StartOrResumeTasks(bool appWasRestarted) { if (WebConfigSettings.DisableTaskQueue) { return; } List <TaskQueue> unfinishedTasks; SiteSettings siteSettings = null; try { TaskQueue.DeleteCompleted(); // the default is false and it may be problematic to try and use this as true // because the app start event only fires 1 time not 1 time per site if (WebConfigSettings.UsePerSiteTaskQueue) { // this also doesn't work in IIS 7 integrated pipeline mode because HttpContext is null siteSettings = CacheHelper.GetCurrentSiteSettings(); } if ((WebConfigSettings.UsePerSiteTaskQueue) && (siteSettings != null)) { unfinishedTasks = TaskQueue.GetUnfinished(siteSettings.SiteGuid); } else { unfinishedTasks = TaskQueue.GetUnfinished(); } if (WebTaskManagerIsRunning(unfinishedTasks, appWasRestarted)) { return; } if ((appWasRestarted) && (unfinishedTasks.Count == 0)) { return; } WebTaskManager taskManager = new WebTaskManager(); taskManager.QueueTask(); taskManager.StartTask(); } catch (DbException ex) { log.Error(ex); } catch (InvalidOperationException ex) { log.Error(ex); } }
void btnClearHistory_Click(object sender, EventArgs e) { TaskQueue.DeleteCompleted(); WebUtils.SetupRedirect(this, SiteRoot + "/Admin/TaskQueueHistory.aspx"); }