fix small exit exceptions

fix the live radar tab switching for .net core 3.0
change events to use "sequential" but still parallel
update the publish scripts
This commit is contained in:
RaidMax 2019-10-09 15:51:02 -05:00
parent 6cd3879bac
commit a37524c726
9 changed files with 59 additions and 15 deletions

View File

@ -96,6 +96,7 @@ namespace IW4MAdmin.Application
try
{
await newEvent.Owner.EventProcessing.WaitAsync(CancellationToken);
await newEvent.Owner.ExecuteEvent(newEvent);
// save the event info to the database
@ -107,6 +108,16 @@ namespace IW4MAdmin.Application
#endif
}
catch (TaskCanceledException)
{
Logger.WriteInfo($"Received quit signal for event id {newEvent.Id}, so we are aborting early");
}
catch (OperationCanceledException)
{
Logger.WriteInfo($"Received quit signal for event id {newEvent.Id}, so we are aborting early");
}
// this happens if a plugin requires login
catch (AuthorizationException ex)
{
@ -134,6 +145,18 @@ namespace IW4MAdmin.Application
Logger.WriteDebug(ex.GetExceptionInfo());
}
finally
{
if (newEvent.Owner.EventProcessing.CurrentCount == 0)
{
newEvent.Owner.EventProcessing.Release(1);
}
#if DEBUG == true
Logger.WriteDebug($"Exiting event process for {args.Event.Id}");
#endif
}
skip:
// tell anyone waiting for the output that we're done

View File

@ -31,10 +31,10 @@ if exist "%SolutionDir%Publish\WindowsPrerelease\ko\" powershell Remove-Item -Fo
if exist "%SolutionDir%Publish\WindowsPrerelease\ru\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\ru'
if exist "%SolutionDir%Publish\WindowsPrerelease\zh-Hans\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\zh-Hans'
if exist "%SolutionDir%Publish\WindowsPrerelease\zh-Hant\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\zh-Hant'
if exist "%SolutionDir%Publish\WindowsPrerelease\cs\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\cs'
if exist "%SolutionDir%Publish\WindowsPrerelease\pl\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\pl'
if exist "%SolutionDir%Publish\WindowsPrerelease\tr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\tr'
if exist "%SolutionDir%Publish\WindowsPrerelease\pt-BR\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\pt-BR'
if exist "%SolutionDir%Publish\WindowsPrerelease\cs\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\cs'
if exist "%SolutionDir%Publish\WindowsPrerelease\pl\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\pl'
if exist "%SolutionDir%Publish\WindowsPrerelease\tr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\tr'
if exist "%SolutionDir%Publish\WindowsPrerelease\pt-BR\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\pt-BR'
echo Deleting extra runtime files
if exist "%SolutionDir%Publish\Windows\runtimes\linux-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-arm'

View File

@ -1,6 +1,7 @@
using SharedLibraryCore;
using SharedLibraryCore.Events;
using SharedLibraryCore.Interfaces;
using System.Linq;
using System.Threading;
namespace IW4MAdmin.Application
@ -8,6 +9,14 @@ namespace IW4MAdmin.Application
class GameEventHandler : IEventHandler
{
readonly ApplicationManager Manager;
private static GameEvent.EventType[] overrideEvents = new[]
{
GameEvent.EventType.Connect,
GameEvent.EventType.Disconnect,
GameEvent.EventType.Quit,
GameEvent.EventType.Stop
};
public GameEventHandler(IManager mgr)
{
Manager = (ApplicationManager)mgr;
@ -19,8 +28,21 @@ namespace IW4MAdmin.Application
ThreadPool.GetMaxThreads(out int workerThreads, out int n);
ThreadPool.GetAvailableThreads(out int availableThreads, out int m);
gameEvent.Owner.Logger.WriteDebug($"There are {workerThreads - availableThreads} active threading tasks");
#endif
if (Manager.Running || overrideEvents.Contains(gameEvent.Type))
{
#if DEBUG
gameEvent.Owner.Logger.WriteDebug($"Adding event with id {gameEvent.Id}");
#endif
Manager.OnServerEvent?.Invoke(gameEvent.Owner, new GameEventArgs(null, false, gameEvent));
}
#if DEBUG
else
{
gameEvent.Owner.Logger.WriteDebug($"Skipping event as we're shutting down {gameEvent.Id}");
}
#endif
Manager.OnServerEvent?.Invoke(gameEvent.Owner, new GameEventArgs(null, false, gameEvent));
}
}
}

View File

@ -30,9 +30,7 @@ namespace IW4MAdmin.Application.IO
{
while (!_server.Manager.CancellationToken.IsCancellationRequested)
{
#if !DEBUG
if (_server.IsInitialized)
#endif
{
try
{

View File

@ -8,7 +8,6 @@ using SharedLibraryCore.Dtos;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Localization;
using SharedLibraryCore.Services;
using System;
using System.Collections.Generic;

View File

@ -17,7 +17,7 @@ namespace LiveRadar.Web.Controllers
[HttpGet]
[Route("Radar/{serverId}")]
public IActionResult Index([FromQuery] long? serverId = null)
public IActionResult Index(long? serverId = null)
{
ViewBag.IsFluid = true;
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"];

View File

@ -1,6 +1,6 @@
dotnet publish WebfrontCore/WebfrontCore.csproj -c Prerelease -f netcoreapp2.2 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish Application/Application.csproj -c Prerelease -f netcoreapp2.2 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -f netcoreapp2.2 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease\GameLogServer
dotnet publish WebfrontCore/WebfrontCore.csproj -c Prerelease -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish Application/Application.csproj -c Prerelease -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease\GameLogServer
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild GameLogServer/GameLogServer.pyproj /p:PublishProfile=PreRelease /p:DeployOnBuild=true /p:PublishProfileRootFolder=X:\IW4MAdmin\GameLogServer\
cd "X:\IW4MAdmin\DEPLOY\"

View File

@ -1,6 +1,6 @@
dotnet publish WebfrontCore/WebfrontCore.csproj -c Release -o X:\IW4MAdmin\Publish\Windows
dotnet publish Application/Application.csproj -c Release -o X:\IW4MAdmin\Publish\Windows
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -o X:\IW4MAdmin\Publish\Windows\GameLogServer
dotnet publish WebfrontCore/WebfrontCore.csproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\Windows /p:PublishProfile=sTABLE
dotnet publish Application/Application.csproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\Windows /p:PublishProfile=Stable
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease\GameLogServer
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild GameLogServer/GameLogServer.pyproj /p:PublishProfile=Stable /p:DeployOnBuild=true /p:PublishProfileRootFolder=X:\IW4MAdmin\GameLogServer\
cd "X:\IW4MAdmin\DEPLOY\"

View File

@ -39,6 +39,7 @@ namespace SharedLibraryCore
ServerConfig = config;
RemoteConnection = new RCon.Connection(IP, Port, Password, Logger, null);
EventProcessing = new SemaphoreSlim(1, 1);
Clients = new List<EFClient>(new EFClient[18]);
Reports = new List<Report>();
ClientHistory = new Queue<PlayerHistory>();
@ -309,6 +310,7 @@ namespace SharedLibraryCore
public IEventParser EventParser { get; set; }
public string LogPath { get; protected set; }
public bool RestartRequested { get; set; }
public SemaphoreSlim EventProcessing { get; private set; }
// Internal
public string IP { get; protected set; }