DD.WellWorkover.Cloud/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs

30 lines
1010 B
C#
Raw Normal View History

using AsbCloudApp.Services;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading;
using System.Threading.Tasks;
2024-08-19 10:01:07 +05:00
namespace AsbCloudInfrastructure.Background.PeriodicWorks;
/// <summary>
/// задача по добавлению данных в таблицу t_data_saub_stat, которая используется для построения РТК-отчета
2024-08-19 10:01:07 +05:00
/// </summary>
internal class WorkDataSaubStat : Work
{
2024-08-19 10:01:07 +05:00
private int Gap = 60;
2024-08-19 10:01:07 +05:00
public WorkDataSaubStat() : base("Generate DataSaubStat entries and save them into Db")
{
Timeout = TimeSpan.FromMinutes(10);
}
2024-08-19 10:01:07 +05:00
protected override async Task Action(string id, IServiceProvider services, Action<string, double?> onProgressCallback, CancellationToken token)
{
var dataSaubStatService = services.GetRequiredService<IDataSaubStatService>();
if (dataSaubStatService != null)
2024-08-19 10:01:07 +05:00
await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token);
}
}