diff options
| author | Michael <michael@simplement-e.fr> | 2014-07-12 10:12:42 +0200 |
|---|---|---|
| committer | Michael <michael@simplement-e.fr> | 2014-07-12 10:12:42 +0200 |
| commit | 83e50d1313a0d0ff6621981cad192072741fd970 (patch) | |
| tree | 504004a0c7ec299a1bf8f713ecc326014678db88 | |
| parent | b68da51921ba70b62efe7f69d9b7a45736c04074 (diff) | |
Not waiting for init task completition in windows service mode in order to avoid timeout on start
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 9e31fc800..ffb6a9add 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -224,23 +224,22 @@ namespace MediaBrowser.ServerApplication // Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT | ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX); - } - - var task = _appHost.Init(initProgress); - Task.WaitAll(task); - - task = _appHost.RunStartupTasks(); - Task.WaitAll(task); - - SystemEvents.SessionEnding += SystemEvents_SessionEnding; - SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; + }
+
+ SystemEvents.SessionEnding += SystemEvents_SessionEnding;
+ SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
+
+ var task = _appHost.Init(initProgress);
+ task = task.ContinueWith(new Action<Task>(a => _appHost.RunStartupTasks()));
if (runService) - { + {
StartService(logManager); } else - { + {
+ Task.WaitAll(task);
+ HideSplashScreen(); ShowTrayIcon(); |
