mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
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);
|
|
}
|
|
|
|
});
|
|
|
|
await Sql.UpdateNonNexusModlistArchivesStatus(results);
|
|
}
|
|
}
|
|
}
|