using AsbCloudApp.Services;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Background
{
///
/// Задача по удалению загруженных отчетов
///
public class WorkToDeleteOldReports : Work
{
public WorkToDeleteOldReports()
: base("work to delete reports older than 30 days")
{
Timeout = TimeSpan.FromMinutes(10);
}
///
/// Удаление отчетов, загруженных ранее 30 дней от текущей даты
///
///
///
///
///
///
protected override async Task Action(string id, IServiceProvider services, Action onProgressCallback, CancellationToken token)
{
var reportService = services.GetRequiredService();
await reportService.DeleteAllOldReportsAsync(TimeSpan.FromDays(30), token);
}
}
}