1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-10 11:10:40 +02:00

Fixed process priority correction.

This commit is contained in:
kay.one 2011-07-17 13:01:37 -07:00
parent af351cbaec
commit 931bb2ea12
3 changed files with 27 additions and 14 deletions

View File

@ -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" />

View File

@ -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();

View File

@ -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