mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 00:22:40 +01:00
Does the process priority thing for the Watchdog
This commit is contained in:
@@ -427,5 +427,8 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
CheckDisposed();
|
||||
reattachInformation.RebootState = RebootState.Normal;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetHighPriority() => process.SetHighPriority();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,6 +665,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
//wait until this boy officially starts so as not to confuse the servers as to who came first
|
||||
var startTime = DateTimeOffset.Now;
|
||||
alphaServer = await alphaServerTask.ConfigureAwait(false);
|
||||
alphaServer.SetHighPriority();
|
||||
|
||||
//extra delay for total ordering
|
||||
var now = DateTimeOffset.Now;
|
||||
@@ -680,7 +681,8 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
bravoServerTask = sessionControllerFactory.Reattach(reattachInfo.Bravo, cancellationToken);
|
||||
|
||||
bravoServer = await bravoServerTask.ConfigureAwait(false);
|
||||
|
||||
bravoServer.SetHighPriority();
|
||||
|
||||
async Task<LaunchResult> CheckLaunch(ISessionController controller, string serverName)
|
||||
{
|
||||
var launch = await controller.LaunchResult.ConfigureAwait(false);
|
||||
|
||||
@@ -12,5 +12,10 @@ namespace Tgstation.Server.Host.Core
|
||||
/// The <see cref="Task{TResult}"/> resulting in the exit code of the process
|
||||
/// </summary>
|
||||
Task<int> Lifetime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set's the owned <see cref="System.Diagnostics.Process.PriorityClass"/> to <see cref="System.Diagnostics.ProcessPriorityClass.AboveNormal"/>
|
||||
/// </summary>
|
||||
void SetHighPriority();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,5 +79,14 @@ namespace Tgstation.Server.Host.Core
|
||||
}
|
||||
catch (InvalidOperationException) { }
|
||||
}
|
||||
|
||||
public void SetHighPriority()
|
||||
{
|
||||
try
|
||||
{
|
||||
handle.PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal;
|
||||
}
|
||||
catch (InvalidOperationException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user