mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fixes for non-Nexus validation
This commit is contained in:
parent
3548e42a64
commit
adbab9576c
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -310,6 +310,34 @@ namespace Wabbajack.Test
|
||||
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LoversLabDownloadWithKnownDelay()
|
||||
{
|
||||
await DownloadDispatcher.GetInstance<LoversLabDownloader>().Prepare();
|
||||
var ini = @"[General]
|
||||
directURL=https://www.loverslab.com/files/file/8567-ds3-weapon-pack-se/?do=download&r=692238&confirm=1&t=1";
|
||||
|
||||
var state = (AbstractDownloadState)await DownloadDispatcher.ResolveArchive(ini.LoadIniString());
|
||||
|
||||
Assert.NotNull(state);
|
||||
|
||||
var converted = RoundTripState(state);
|
||||
Assert.True(await converted.Verify(new Archive(state: null!) { Size = 20}));
|
||||
|
||||
// Verify with different Size
|
||||
Assert.False(await converted.Verify(new Archive(state: null!) { Size = 15}));
|
||||
|
||||
|
||||
using var filename = new TempFile();
|
||||
Assert.True(converted.IsWhitelisted(new ServerWhitelist { AllowedPrefixes = new List<string>() }));
|
||||
|
||||
await converted.Download(new Archive(state: null!) { Name = "Known Loverslab delay" }, filename.Path);
|
||||
|
||||
Assert.Equal(Hash.FromBase64("eSIyd+KOG3s="), await filename.Path.FileHashAsync());
|
||||
|
||||
Assert.Equal("Cheese for Everyone!", await filename.Path.ReadAllTextAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task VectorPlexusDownload()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user