Fixed process priority correction.

pull/4/head
kay.one 14 years ago
parent af351cbaec
commit 931bb2ea12

@ -184,13 +184,15 @@
<Content Include="Content\Blueprint\ie.css" />
<Content Include="Content\Blueprint\screen.css" />
<Content Include="Content\Blueprint\liquid.css" />
<Content Include="Content\jQueryUI\images\ui-bg_diagonals-thick_30_0b58a2_40x40.png" />
<Content Include="Content\Images\x_16.png" />
<Content Include="Content\jQueryUI\images\ui-bg_diagonals-thick_30_a32d00_40x40.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_0_0b3e6f_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_0_065efe_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_0_aaaaaa_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_20_111111_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_20_333333_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_40_00498f_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_20_ffffff_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_30_065efe_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_40_065efe_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-bg_white-lines_10_000000_40x100.png" />
<Content Include="Content\jQueryUI\images\ui-icons_98d2fb_256x240.png" />
<Content Include="Content\jQueryUI\images\ui-icons_9ccdfc_256x240.png" />
<Content Include="Content\jQueryUI\images\ui-icons_ffffff_256x240.png" />

@ -65,8 +65,9 @@ namespace NzbDrone
Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName);
IISProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
IISProcess.Start();
IISProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
IISProcess.BeginErrorReadLine();
IISProcess.BeginOutputReadLine();

@ -64,25 +64,35 @@ namespace NzbDrone
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

Loading…
Cancel
Save