Small server improvements

This commit is contained in:
Timothy Baldridge 2020-01-01 19:04:57 -07:00
parent 936fee5d0c
commit 9074941229
4 changed files with 15 additions and 2 deletions

View File

@ -71,6 +71,14 @@ namespace Wabbajack.CacheServer
}
public static async Task StartJobQueue()
{
foreach (var task in Enumerable.Range(0, 4))
{
var tsk = StartJobQueueInner();
}
}
private static async Task StartJobQueueInner()
{
while (true)
{

View File

@ -66,6 +66,7 @@ namespace Wabbajack.CacheServer.Jobs
File.Delete(downloadDest);
else
File.Move(downloadDest, to_path);
Utils.DeleteDirectory(Path.Combine(Server.Config.Indexer.DownloadDir, folder));
}
return JobResult.Success();

View File

@ -105,7 +105,7 @@ namespace Wabbajack.CacheServer
}
}).FireAndForget();
}
public static async Task ValidateLists()
public static async Task ValidateLists(bool skipIfNewer = true)
{
Utils.Log("Cleaning Nexus Cache");
var client = new HttpClient();
@ -133,6 +133,10 @@ namespace Wabbajack.CacheServer
private static async Task ValidateList(ModlistMetadata list, WorkQueue queue)
{
var existing = await Server.Config.ListValidation.Connect().FindOneAsync(l => l.Id == list.Links.MachineURL);
if (existing != null && DateTime.Now - existing.DetailedStatus.Checked < TimeSpan.FromHours(2))
return;
var modlist_path = Path.Combine(Consts.ModListDownloadFolder, list.Links.MachineURL + ExtensionManager.Extension);
if (list.NeedsDownload(modlist_path))

View File

@ -55,7 +55,7 @@ namespace Wabbajack.CacheServer
return mods.Select(mod => new { game = game, mod = mod });
}).ToList();
Utils.Log($"Getting update lits for {gameTasks.Count} games");
Utils.Log($"Getting update list for {gameTasks.Count} games");
var purge = (await Task.WhenAll(gameTasks))
.SelectMany(i => i)