diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj
index 0d6a9a2b6..2874ee488 100644
--- a/NzbDrone.Web/NzbDrone.Web.csproj
+++ b/NzbDrone.Web/NzbDrone.Web.csproj
@@ -184,13 +184,15 @@
-
+
-
+
-
-
+
+
+
+
diff --git a/NzbDrone/IISController.cs b/NzbDrone/IISController.cs
index d85262510..fcc4018e8 100644
--- a/NzbDrone/IISController.cs
+++ b/NzbDrone/IISController.cs
@@ -65,8 +65,9 @@ internal static Process StartServer()
Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName);
- IISProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
+
IISProcess.Start();
+ IISProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
IISProcess.BeginErrorReadLine();
IISProcess.BeginOutputReadLine();
diff --git a/NzbDrone/Program.cs b/NzbDrone/Program.cs
index 0eea8feef..deb6c13ab 100644
--- a/NzbDrone/Program.cs
+++ b/NzbDrone/Program.cs
@@ -64,25 +64,35 @@ private static void Main()
Console.ReadLine();
}
- static void prioCheckTimer_Elapsed(object sender, ElapsedEventArgs e)
+ private static void prioCheckTimer_Elapsed(object sender, ElapsedEventArgs e)
{
Process currentProcess = Process.GetCurrentProcess();
- if (currentProcess.PriorityClass < ProcessPriorityClass.Normal)
+ if (currentProcess.PriorityClass != ProcessPriorityClass.Normal)
{
- Logger.Info("Promoting Nzbdrone.exe process priority from {0} to {1}", currentProcess.PriorityClass,
- ProcessPriorityClass.Normal);
- currentProcess.PriorityClass = ProcessPriorityClass.Normal;
+ SetPriority(currentProcess);
}
- if (IISController.IISProcess != null && IISController.IISProcess.PriorityClass < ProcessPriorityClass.Normal)
+ if (IISController.IISProcess != null)
{
- Logger.Info("Promoting IISExpress process priority from {0} to {1}", IISController.IISProcess.PriorityClass,
- ProcessPriorityClass.Normal);
- IISController.IISProcess.PriorityClass = ProcessPriorityClass.Normal;
+ IISController.IISProcess.Refresh();
+
+ if (IISController.IISProcess.PriorityClass != ProcessPriorityClass.Normal && IISController.IISProcess.PriorityClass != ProcessPriorityClass.AboveNormal)
+ {
+ SetPriority(IISController.IISProcess);
+ }
}
}
+ private static void SetPriority(Process process)
+ {
+ Logger.Info("Updating [{0}] process priority from {1} to {2}",
+ process.ProcessName,
+ IISController.IISProcess.PriorityClass,
+ ProcessPriorityClass.Normal);
+ process.PriorityClass = ProcessPriorityClass.Normal;
+ }
+
#if DEBUG