Tweaked SingleInstancePolicy not to cancel startup if AppData is overridden is set.

pull/2279/head
Taloth Saldono 8 years ago
parent a49e37239e
commit 23552c3267

@ -88,11 +88,15 @@ namespace NzbDrone.Host
{ {
var instancePolicy = _container.Resolve<ISingleInstancePolicy>(); var instancePolicy = _container.Resolve<ISingleInstancePolicy>();
if (isService) if (startupContext.Flags.Contains(StartupContext.TERMINATE))
{ {
instancePolicy.KillAllOtherInstance(); instancePolicy.KillAllOtherInstance();
} }
else if (startupContext.Flags.Contains(StartupContext.TERMINATE)) else if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
{
instancePolicy.WarnIfAlreadyRunning();
}
else if (isService)
{ {
instancePolicy.KillAllOtherInstance(); instancePolicy.KillAllOtherInstance();
} }

@ -10,6 +10,7 @@ namespace NzbDrone.Host
{ {
void PreventStartIfAlreadyRunning(); void PreventStartIfAlreadyRunning();
void KillAllOtherInstance(); void KillAllOtherInstance();
void WarnIfAlreadyRunning();
} }
public class SingleInstancePolicy : ISingleInstancePolicy public class SingleInstancePolicy : ISingleInstancePolicy
@ -45,6 +46,14 @@ namespace NzbDrone.Host
} }
} }
public void WarnIfAlreadyRunning()
{
if (IsAlreadyRunning())
{
_logger.Debug("Another instance of Sonarr is already running.");
}
}
private bool IsAlreadyRunning() private bool IsAlreadyRunning()
{ {
return GetOtherNzbDroneProcessIds().Any(); return GetOtherNzbDroneProcessIds().Any();

Loading…
Cancel
Save