This commit is contained in:
Mikhail Kuznetsov
2023-06-15 10:14:27 +10:00
parent ab7e88c0ff
commit 73a824057b
8 changed files with 67 additions and 27 deletions

View File

@@ -2,6 +2,6 @@
{
public class WorkerSettings
{
public int OccursEvery { get; set; }
public TimeSpan OccursEvery { get; set; }
}
}

View File

@@ -24,6 +24,7 @@ namespace PARR.Worker
logger.LogInformation("--- Сервис запущен! ---");
while (!stoppingToken.IsCancellationRequested)
{
logger.LogInformation("--- --- --- --- Начало синхронизации --- --- --- ---");
using var scope = serviceProvider.CreateScope();
var services = scope.ServiceProvider;
var syncer = services.GetService<ISyncher>();
@@ -36,7 +37,12 @@ namespace PARR.Worker
//await attachmentUploader.UploadAsync();
//logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
await Task.Delay(workerSettings.OccursEvery, stoppingToken);
logger.LogInformation("=== === === === Конец синхронизации === === === ===");
var mills = (int?) workerSettings?.OccursEvery.TotalMilliseconds ?? 60*1000;
await Task.Delay(mills, stoppingToken);
}
}
}

View File

@@ -37,7 +37,7 @@
"IncludeAddresses": "aihit@gvc.rzd"
},
"WorkerSettings": {
"OccursEvery": 60000
"OccursEvery": "00:10:00.0"
}
}