DD.WellWorkover.Cloud/AsbCloudInfrastructure/Background/WorkToDeleteOldReports.cs

24 lines
749 B
C#
Raw Normal View History

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);
}
protected override async Task Action(string id, IServiceProvider services, Action<string, double?> onProgressCallback, CancellationToken token)
{
var reportService = services.GetRequiredService<IReportService>();
await reportService.DeleteAllOldReportsAsync(-30, token);
}
}
}