Not waiting for init task completition in windows service mode in order to avoid timeout on start

This commit is contained in:
Michael 2014-07-12 10:12:42 +02:00
parent b68da51921
commit 83e50d1313

View File

@ -226,21 +226,20 @@ namespace MediaBrowser.ServerApplication
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX); 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.SessionEnding += SystemEvents_SessionEnding;
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
var task = _appHost.Init(initProgress);
task = task.ContinueWith(new Action<Task>(a => _appHost.RunStartupTasks()));
if (runService) if (runService)
{ {
StartService(logManager); StartService(logManager);
} }
else else
{ {
Task.WaitAll(task);
HideSplashScreen(); HideSplashScreen();
ShowTrayIcon(); ShowTrayIcon();