mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
app lifecycle cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using NzbDrone.Host;
|
||||
@@ -17,21 +18,31 @@ namespace NzbDrone.Console
|
||||
{
|
||||
var startupArgs = new StartupArguments(args);
|
||||
LogTargets.Register(startupArgs, false, true);
|
||||
Bootstrap.Start(startupArgs, new ConsoleAlerts());
|
||||
var container = Bootstrap.Start(startupArgs, new ConsoleAlerts());
|
||||
|
||||
if (startupArgs.InstallService || startupArgs.UninstallService)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var serviceFactory = container.Resolve<INzbDroneServiceFactory>();
|
||||
|
||||
while (!serviceFactory.IsServiceStopped)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
catch (TerminateApplicationException)
|
||||
{
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
Logger.FatalException("EPIC FAIL!", e);
|
||||
System.Console.WriteLine("Press any key to exit...");
|
||||
System.Console.ReadLine();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user