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 System.Threading.Tasks;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
using Wabbajack.BuildServer.BackendServices;
|
using Wabbajack.BuildServer.BackendServices;
|
||||||
|
using Wabbajack.BuildServer.Controllers;
|
||||||
using Wabbajack.BuildServer.Model.Models;
|
using Wabbajack.BuildServer.Model.Models;
|
||||||
using Wabbajack.BuildServer.Models;
|
using Wabbajack.BuildServer.Models;
|
||||||
using Wabbajack.BuildServer.Models.JobQueue;
|
using Wabbajack.BuildServer.Models.JobQueue;
|
||||||
@ -63,6 +64,8 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
Utils.Log("Updating modlists");
|
Utils.Log("Updating modlists");
|
||||||
await RevalidateLists();
|
await RevalidateLists();
|
||||||
|
|
||||||
|
ListValidation.ResetCache();
|
||||||
|
|
||||||
Utils.Log("Checking validated results");
|
Utils.Log("Checking validated results");
|
||||||
var data = await ModlistMetadata.LoadFromGithub();
|
var data = await ModlistMetadata.LoadFromGithub();
|
||||||
Assert.Single(data);
|
Assert.Single(data);
|
||||||
@ -87,6 +90,8 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
var evalService = new ValidateNonNexusArchives(Fixture.GetService<SqlService>(), Fixture.GetService<AppSettings>());
|
var evalService = new ValidateNonNexusArchives(Fixture.GetService<SqlService>(), Fixture.GetService<AppSettings>());
|
||||||
await evalService.Execute();
|
await evalService.Execute();
|
||||||
|
|
||||||
|
ListValidation.ResetCache();
|
||||||
|
|
||||||
data = await ModlistMetadata.LoadFromGithub();
|
data = await ModlistMetadata.LoadFromGithub();
|
||||||
Assert.Single(data);
|
Assert.Single(data);
|
||||||
Assert.Equal(1, data.First().ValidationSummary.Failed);
|
Assert.Equal(1, data.First().ValidationSummary.Failed);
|
||||||
@ -101,6 +106,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
// Rerun the validation service to fix the list
|
// Rerun the validation service to fix the list
|
||||||
await evalService.Execute();
|
await evalService.Execute();
|
||||||
|
|
||||||
|
ListValidation.ResetCache();
|
||||||
|
|
||||||
data = await ModlistMetadata.LoadFromGithub();
|
data = await ModlistMetadata.LoadFromGithub();
|
||||||
Assert.Single(data);
|
Assert.Single(data);
|
||||||
@ -139,6 +145,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
await evalService.Execute();
|
await evalService.Execute();
|
||||||
await RevalidateLists();
|
await RevalidateLists();
|
||||||
|
|
||||||
|
ListValidation.ResetCache();
|
||||||
|
|
||||||
Utils.Log("Checking updated results");
|
Utils.Log("Checking updated results");
|
||||||
data = await ModlistMetadata.LoadFromGithub();
|
data = await ModlistMetadata.LoadFromGithub();
|
||||||
|
@ -6,6 +6,7 @@ using System.Net;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FluentFTP;
|
using FluentFTP;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Nettle;
|
using Nettle;
|
||||||
using Wabbajack.BuildServer.Model.Models;
|
using Wabbajack.BuildServer.Model.Models;
|
||||||
@ -31,14 +32,30 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
Updated,
|
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);
|
_updater = new ModlistUpdater(null, sql, settings);
|
||||||
_settings = 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()
|
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();
|
var data = await SQL.GetValidationData();
|
||||||
|
|
||||||
using var queue = new WorkQueue();
|
using var queue = new WorkQueue();
|
||||||
@ -87,6 +104,9 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
return (summary, detailed);
|
return (summary, detailed);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(1));
|
||||||
|
Cache.Set(ModListSummariesKey, results, cacheOptions);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +241,8 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
return Ok((await DetailedStatus(Name)).ToJson());
|
return Ok((await DetailedStatus(Name)).ToJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task<DetailedStatus> DetailedStatus(string Name)
|
private async Task<DetailedStatus> DetailedStatus(string Name)
|
||||||
{
|
{
|
||||||
return (await GetSummaries())
|
return (await GetSummaries())
|
||||||
|
Loading…
Reference in New Issue
Block a user