Worker
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
{
|
||||
public class WorkerSettings
|
||||
{
|
||||
public int OccursEvery { get; set; }
|
||||
public TimeSpan OccursEvery { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"IncludeAddresses": "aihit@gvc.rzd"
|
||||
},
|
||||
"WorkerSettings": {
|
||||
"OccursEvery": 60000
|
||||
"OccursEvery": "00:10:00.0"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user