2020-04-12 04:18:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wabbajack.BuildServer.Model.Models;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.BuildServer.BackendServices
|
|
|
|
|
{
|
|
|
|
|
public class ValidateNonNexusArchives : ABackendService
|
|
|
|
|
{
|
|
|
|
|
public ValidateNonNexusArchives(SqlService sql, AppSettings settings) : base(sql, settings, TimeSpan.FromHours(2))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async Task Execute()
|
|
|
|
|
{
|
|
|
|
|
var archives = await Sql.GetNonNexusModlistArchives();
|
|
|
|
|
using var queue = new WorkQueue();
|
|
|
|
|
var results = await archives.PMap(queue, async archive =>
|
|
|
|
|
{
|
2020-04-13 23:31:48 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var isValid = await archive.State.Verify(archive);
|
|
|
|
|
return (Archive: archive, IsValid: isValid);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return (Archive: archive, IsValid: false);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-12 04:18:21 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await Sql.UpdateNonNexusModlistArchivesStatus(results);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|