|
|
@ -1,4 +1,5 @@
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
using NzbDrone.Common.Processes;
|
|
|
|
using NzbDrone.Common.Processes;
|
|
|
|
|
|
|
|
|
|
|
@ -13,11 +14,13 @@ namespace NzbDrone.Host
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IRuntimeInfo _runtimeInfo;
|
|
|
|
private readonly IRuntimeInfo _runtimeInfo;
|
|
|
|
private readonly IProcessProvider _processProvider;
|
|
|
|
private readonly IProcessProvider _processProvider;
|
|
|
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider)
|
|
|
|
public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_runtimeInfo = runtimeInfo;
|
|
|
|
_runtimeInfo = runtimeInfo;
|
|
|
|
_processProvider = processProvider;
|
|
|
|
_processProvider = processProvider;
|
|
|
|
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Spin()
|
|
|
|
public void Spin()
|
|
|
@ -27,8 +30,11 @@ namespace NzbDrone.Host
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("wait loop was terminated.");
|
|
|
|
|
|
|
|
|
|
|
|
if (_runtimeInfo.RestartPending)
|
|
|
|
if (_runtimeInfo.RestartPending)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Info("attemptig restart.");
|
|
|
|
_processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, "--restart --nobrowser");
|
|
|
|
_processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, "--restart --nobrowser");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|