fix backgroundService exception handler

This commit is contained in:
Фролов 2021-05-24 16:30:35 +05:00
parent ae85cdedd5
commit 7f12f48cb9

View File

@ -16,19 +16,19 @@ namespace AsbCloudInfrastructure.Services
protected override async Task ExecuteAsync(CancellationToken token)
{
try
while (!token.IsCancellationRequested)
{
while (!token.IsCancellationRequested)
try
{
if (tasksQueue.TryDequeue(out var item))
await Task.Run(()=>item.action(item.id), token);
await Task.Run(() => item.action(item.id), token);
else
await Task.Delay(100, token);
}
}
catch
{
//logger ?
catch
{
//logger ?
}
}
}