Eric Reed 12 years ago
commit a26ef05e7a

@ -106,7 +106,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// <param name="task">The task.</param>
private void QueueScheduledTask(IScheduledTaskWorker task)
{
var type = task.GetType();
var type = task.ScheduledTask.GetType();
lock (_taskQueue)
{
@ -173,14 +173,46 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
return ((ScheduledTaskWorker)task).Execute();
}
/// <summary>
/// Called when [task executing].
/// </summary>
/// <param name="task">The task.</param>
internal void OnTaskExecuting(IScheduledTask task)
{
EventHelper.QueueEventIfNotNull(TaskExecuting, task, EventArgs.Empty, Logger);
}
/// <summary>
/// Called when [task completed].
/// </summary>
/// <param name="task">The task.</param>
/// <param name="result">The result.</param>
internal void OnTaskCompleted(IScheduledTask task, TaskResult result)
{
EventHelper.QueueEventIfNotNull(TaskExecuting, task, new GenericEventArgs<TaskResult> { Argument = result }, Logger);
ExecuteQueuedTasks();
}
/// <summary>
/// Executes the queued tasks.
/// </summary>
private void ExecuteQueuedTasks()
{
// Execute queued tasks
lock (_taskQueue)
{
foreach (var type in _taskQueue.ToList())
{
var scheduledTask = ScheduledTasks.First(t => t.ScheduledTask.GetType() == type);
if (scheduledTask.State == TaskState.Idle)
{
((ScheduledTaskWorker)scheduledTask).Execute();
_taskQueue.Remove(type);
}
}
}
}
}
}

@ -134,6 +134,11 @@ namespace MediaBrowser.ServerApplication
Logger.ErrorException("UnhandledException", exception);
MessageBox.Show("Unhandled exception: " + exception.Message);
if (!Debugger.IsAttached)
{
Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
}
}
/// <summary>

@ -43,12 +43,13 @@ namespace MediaBrowser.WebDashboard.Api
/// <param name="logger">The logger.</param>
/// <param name="taskManager">The task manager.</param>
/// <param name="userManager">The user manager.</param>
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager)
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager)
: base(logger)
{
_appHost = appHost;
_taskManager = taskManager;
_userManager = userManager;
_libraryManager = libraryManager;
}
/// <summary>

@ -382,7 +382,7 @@ var Dashboard = {
setTimeout(function () {
Dashboard.reloadPageWhenServerAvailable();
}, 500);
}, 250);
}).fail(function () {
Dashboard.suppressAjaxErrors = false;
@ -391,10 +391,17 @@ var Dashboard = {
reloadPageWhenServerAvailable: function (retryCount) {
ApiClient.getSystemInfo().done(function () {
Dashboard.reloadPage();
ApiClient.getSystemInfo().done(function (info) {
// If this is back to false, the restart completed
if (!info.HasPendingRestart) {
Dashboard.reloadPage();
} else {
Dashboard.reloadPageWhenServerAvailable(retryCount);
}
}).fail(function () {
setTimeout(function () {
retryCount = retryCount || 0;

Loading…
Cancel
Save