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

pull/110/head
Qstick 7 years ago
parent d6bb4c29d0
commit ba27554bd3

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

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
@ -10,6 +10,7 @@ namespace NzbDrone.Host
{
void PreventStartIfAlreadyRunning();
void KillAllOtherInstance();
void WarnIfAlreadyRunning();
}
public class SingleInstancePolicy : ISingleInstancePolicy
@ -45,6 +46,14 @@ namespace NzbDrone.Host
}
}
public void WarnIfAlreadyRunning()
{
if (IsAlreadyRunning())
{
_logger.Debug("Another instance of Lidarr is already running.");
}
}
private bool IsAlreadyRunning()
{
return GetOtherNzbDroneProcessIds().Any();
@ -76,4 +85,4 @@ namespace NzbDrone.Host
}
}
}
}
}

Loading…
Cancel
Save