소스 검색

#51 - Restart the server took long time, and dashboard will die

LukePulverenti 12 년 전
부모
커밋
3dc9cacfad
2개의 변경된 파일15개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 0
      MediaBrowser.ServerApplication/App.xaml.cs
  2. 10 3
      MediaBrowser.WebDashboard/Html/scripts/site.js

+ 5 - 0
MediaBrowser.ServerApplication/App.xaml.cs

@@ -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>

+ 10 - 3
MediaBrowser.WebDashboard/Html/scripts/site.js

@@ -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;