wabbajack/Wabbajack.BuildServer/BackendServices/ValidateNonNexusArchives.cs

36 lines
1.0 KiB
C#
Raw Normal View History

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 =>
{
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);
}
}
}