Merge pull request from wabbajack-tools/non-nexus-validation-fixes

Fixes for non-Nexus validation
This commit is contained in:
Timothy Baldridge 2020-04-28 16:47:35 -06:00 committed by GitHub
commit e24cbbeb0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -19,6 +19,7 @@ namespace Wabbajack.BuildServer.BackendServices
public async Task RunLoop(CancellationToken token)
{
Utils.Log($"Starting loop for {GetType()}");
while (!token.IsCancellationRequested)
{
try
@ -27,7 +28,7 @@ namespace Wabbajack.BuildServer.BackendServices
}
catch (Exception ex)
{
Utils.Log($"Error executing {this}");
Utils.Log($"Error executing {GetType()}");
Utils.Log(ex.ToString());
}

View File

@ -1,7 +1,9 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Wabbajack.BuildServer.Model.Models;
using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
namespace Wabbajack.BuildServer.BackendServices
{
@ -13,8 +15,11 @@ namespace Wabbajack.BuildServer.BackendServices
public override async Task Execute()
{
Utils.Log("Updating Non Nexus archives");
var archives = await Sql.GetNonNexusModlistArchives();
Utils.Log($"Validating {archives.Count} Non-Nexus archives.");
using var queue = new WorkQueue();
await DownloadDispatcher.PrepareAll(archives.Select(a => a.State));
var results = await archives.PMap(queue, async archive =>
{
try
@ -22,8 +27,9 @@ namespace Wabbajack.BuildServer.BackendServices
var isValid = await archive.State.Verify(archive);
return (Archive: archive, IsValid: isValid);
}
catch (Exception)
catch (Exception ex)
{
Utils.Log($"Got Validation error {ex}");
return (Archive: archive, IsValid: false);
}

View File

@ -78,8 +78,10 @@ namespace Wabbajack.BuildServer
Utils.LogMessages.OfType<IUserIntervention>().Subscribe(u => u.Cancel());
if (!Settings.JobScheduler) return;
var token = new CancellationTokenSource();
var task = RunNexusCacheLoop();
var listIngest = (new ListIngest(Sql, Settings)).RunLoop(CancellationToken.None);
var listIngest = (new ListIngest(Sql, Settings)).RunLoop(token.Token);
var nonNexus = (new ValidateNonNexusArchives(Sql, Settings)).RunLoop(token.Token);
while (true)
{