forked from ddrilling/AsbCloudServer
Класс WorkToDeleteOldReports вынесен в отдельный файл
This commit is contained in:
parent
5ad342d4d3
commit
66c0e6ad65
23
AsbCloudInfrastructure/Background/WorkToDeleteOldReports.cs
Normal file
23
AsbCloudInfrastructure/Background/WorkToDeleteOldReports.cs
Normal file
@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -18,20 +18,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
public class ReportService : IReportService
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
private readonly IAsbCloudDbContext db;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly FileService fileService;
|
||||
|
@ -29,7 +29,7 @@ namespace AsbCloudInfrastructure
|
||||
_ = provider.GetRequiredService<ITelemetryDataCache<TelemetryDataSpinDto>>();
|
||||
|
||||
var backgroundWorker = provider.GetRequiredService<PeriodicBackgroundWorker>();
|
||||
backgroundWorker.Add<ReportService.WorkToDeleteOldReports>(TimeSpan.FromDays(1));
|
||||
backgroundWorker.Add<WorkToDeleteOldReports>(TimeSpan.FromDays(1));
|
||||
backgroundWorker.Add<WellInfoService.WorkWellInfoUpdate>(TimeSpan.FromMinutes(30));
|
||||
backgroundWorker.Add<WorkOperationDetection>(TimeSpan.FromMinutes(15));
|
||||
backgroundWorker.Add<WorkSubsystemOperationTimeCalc>(TimeSpan.FromMinutes(30));
|
||||
|
Loading…
Reference in New Issue
Block a user