Increase interactive console responsiveness, misc

Previously we were sleeping always, also after execution of the command and after wrong keys being pressed, which resulted in excessive delay if user mashed his keyboard like a madman before hitting c to enter the console, entirely unnecessarily.
This commit is contained in:
JustArchi
2022-05-18 11:30:46 +02:00
parent 055af32219
commit a08c85e40b
2 changed files with 3 additions and 3 deletions

View File

@@ -311,6 +311,8 @@ internal static class Logging {
while (!Program.ShutdownSequenceInitialized) {
try {
if (IsWaitingForUserInput || !Console.KeyAvailable) {
await Task.Delay(ConsoleResponsivenessDelay).ConfigureAwait(false);
continue;
}
@@ -379,8 +381,6 @@ internal static class Logging {
ASF.ArchiLogger.LogGenericException(e);
return;
} finally {
await Task.Delay(ConsoleResponsivenessDelay).ConfigureAwait(false);
}
}
}

View File

@@ -61,7 +61,7 @@ internal sealed class SteamTarget : AsyncTaskTarget {
protected override async Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken cancellationToken) {
ArgumentNullException.ThrowIfNull(logEvent);
base.Write(logEvent);
Write(logEvent);
if ((SteamID == 0) || (Bot.Bots == null) || Bot.Bots.IsEmpty) {
return;