mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Priority is now set using a timer
This commit is contained in:
parent
d640fa65e8
commit
f1ec592834
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using Exceptioneer.WindowsFormsClient;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone
|
||||
{
|
||||
internal static class Program
|
||||
@ -20,7 +20,9 @@ private static void Main()
|
||||
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
|
||||
FixPriorities();
|
||||
var prioCheckTimer = new System.Timers.Timer(5000);
|
||||
prioCheckTimer.Elapsed += prioCheckTimer_Elapsed;
|
||||
prioCheckTimer.Enabled = true;
|
||||
|
||||
currentProcess.EnableRaisingEvents = true;
|
||||
currentProcess.Exited += ProgramExited;
|
||||
@ -35,7 +37,6 @@ private static void Main()
|
||||
#if DEBUG
|
||||
Attach();
|
||||
#endif
|
||||
FixPriorities();
|
||||
|
||||
if (Environment.UserInteractive)
|
||||
{
|
||||
@ -63,7 +64,7 @@ private static void Main()
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
private static void FixPriorities()
|
||||
static void prioCheckTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
if (currentProcess.PriorityClass < ProcessPriorityClass.Normal)
|
||||
@ -73,8 +74,8 @@ private static void FixPriorities()
|
||||
currentProcess.PriorityClass = ProcessPriorityClass.Normal;
|
||||
}
|
||||
|
||||
|
||||
if (IISController.IISProcess!=null && IISController.IISProcess.PriorityClass < ProcessPriorityClass.Normal)
|
||||
|
||||
if (IISController.IISProcess != null && IISController.IISProcess.PriorityClass < ProcessPriorityClass.Normal)
|
||||
{
|
||||
Logger.Info("Promoting IISExpress process priority from {0} to {1}", IISController.IISProcess.PriorityClass,
|
||||
ProcessPriorityClass.Normal);
|
||||
@ -82,6 +83,8 @@ private static void FixPriorities()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if DEBUG
|
||||
private static void Attach()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user