tweak game interface values again

This commit is contained in:
RaidMax 2022-03-02 08:28:41 -06:00
parent a4c3f9c2d1
commit 55b0caf900
2 changed files with 13 additions and 3 deletions

View File

@ -307,6 +307,11 @@ const sendEvent = (server, responseExpected, event, subtype, origin, target, dat
const start = new Date();
while (pendingOut && pendingCheckCount <= 10) {
if (server.Throttled) {
logger.WriteWarning('Server is throttled, so we are not attempting to send data');
return;
}
try {
const out = server.GetServerDvar(outDvar);
pendingOut = !(out == null || out === '' || out === 'null');
@ -318,6 +323,7 @@ const sendEvent = (server, responseExpected, event, subtype, origin, target, dat
logger.WriteDebug('Waiting for event bus to be cleared');
System.Threading.Tasks.Task.Delay(1000).Wait();
}
pendingCheckCount++;
}
@ -397,6 +403,10 @@ const initialize = (server) => {
};
const pollForEvents = server => {
if (server.Throttled) {
return;
}
const logger = _serviceResolver.ResolveService('ILogger');
let input;

View File

@ -391,7 +391,7 @@ namespace SharedLibraryCore
public string[] ExecuteServerCommand(string command)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
tokenSource.CancelAfter(TimeSpan.FromSeconds(0.5));
try
{
@ -406,7 +406,7 @@ namespace SharedLibraryCore
public string GetServerDvar(string dvarName)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
tokenSource.CancelAfter(TimeSpan.FromSeconds(0.5));
try
{
return this.GetDvarAsync<string>(dvarName, token: tokenSource.Token).GetAwaiter().GetResult().Value;
@ -420,7 +420,7 @@ namespace SharedLibraryCore
public bool SetServerDvar(string dvarName, string dvarValue)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
tokenSource.CancelAfter(TimeSpan.FromSeconds(0.5));
try
{
this.SetDvarAsync(dvarName, dvarValue, tokenSource.Token).GetAwaiter().GetResult();