mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix VFS FullPath errors
This commit is contained in:
parent
0ece811619
commit
3f94187bac
@ -7,6 +7,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HtmlAgilityPack;
|
||||
using Wabbajack.BuildServer.BackendServices;
|
||||
using Wabbajack.BuildServer.Controllers;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
using Wabbajack.BuildServer.Models;
|
||||
using Wabbajack.BuildServer.Models.JobQueue;
|
||||
@ -62,6 +63,8 @@ namespace Wabbajack.BuildServer.Test
|
||||
Consts.ModlistMetadataURL = modlists.ToString();
|
||||
Utils.Log("Updating modlists");
|
||||
await RevalidateLists();
|
||||
|
||||
ListValidation.ResetCache();
|
||||
|
||||
Utils.Log("Checking validated results");
|
||||
var data = await ModlistMetadata.LoadFromGithub();
|
||||
@ -87,6 +90,8 @@ namespace Wabbajack.BuildServer.Test
|
||||
var evalService = new ValidateNonNexusArchives(Fixture.GetService<SqlService>(), Fixture.GetService<AppSettings>());
|
||||
await evalService.Execute();
|
||||
|
||||
ListValidation.ResetCache();
|
||||
|
||||
data = await ModlistMetadata.LoadFromGithub();
|
||||
Assert.Single(data);
|
||||
Assert.Equal(1, data.First().ValidationSummary.Failed);
|
||||
@ -101,7 +106,8 @@ namespace Wabbajack.BuildServer.Test
|
||||
// Rerun the validation service to fix the list
|
||||
await evalService.Execute();
|
||||
|
||||
|
||||
ListValidation.ResetCache();
|
||||
|
||||
data = await ModlistMetadata.LoadFromGithub();
|
||||
Assert.Single(data);
|
||||
Assert.Equal(0, data.First().ValidationSummary.Failed);
|
||||
@ -139,7 +145,8 @@ namespace Wabbajack.BuildServer.Test
|
||||
await evalService.Execute();
|
||||
await RevalidateLists();
|
||||
|
||||
|
||||
ListValidation.ResetCache();
|
||||
|
||||
Utils.Log("Checking updated results");
|
||||
data = await ModlistMetadata.LoadFromGithub();
|
||||
Assert.Single(data);
|
||||
|
@ -6,6 +6,7 @@ using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using FluentFTP;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Nettle;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
@ -31,14 +32,30 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
Updated,
|
||||
}
|
||||
|
||||
public ListValidation(ILogger<ListValidation> logger, SqlService sql, AppSettings settings) : base(logger, sql)
|
||||
public ListValidation(ILogger<ListValidation> logger, SqlService sql, IMemoryCache cache, AppSettings settings) : base(logger, sql)
|
||||
{
|
||||
_updater = new ModlistUpdater(null, sql, settings);
|
||||
_settings = settings;
|
||||
Cache = cache;
|
||||
}
|
||||
|
||||
public static IMemoryCache Cache { get; set; }
|
||||
public const string ModListSummariesKey = "ModListSummaries";
|
||||
|
||||
public static void ResetCache()
|
||||
{
|
||||
Cache?.Remove(ModListSummariesKey);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<(ModListSummary Summary, DetailedStatus Detailed)>> GetSummaries()
|
||||
{
|
||||
|
||||
if (Cache.TryGetValue(ModListSummariesKey, out object result))
|
||||
{
|
||||
return (IEnumerable<(ModListSummary Summary, DetailedStatus Detailed)>)result;
|
||||
}
|
||||
|
||||
|
||||
var data = await SQL.GetValidationData();
|
||||
|
||||
using var queue = new WorkQueue();
|
||||
@ -87,6 +104,9 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
return (summary, detailed);
|
||||
});
|
||||
|
||||
|
||||
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(1));
|
||||
Cache.Set(ModListSummariesKey, results, cacheOptions);
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -221,6 +241,8 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
return Ok((await DetailedStatus(Name)).ToJson());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<DetailedStatus> DetailedStatus(string Name)
|
||||
{
|
||||
return (await GetSummaries())
|
||||
|
Loading…
Reference in New Issue
Block a user