diff --git a/AsbCloudInfrastructure/Services/BackgroundWorkerService.cs b/AsbCloudInfrastructure/Services/BackgroundWorkerService.cs index 876d7635..e675db3a 100644 --- a/AsbCloudInfrastructure/Services/BackgroundWorkerService.cs +++ b/AsbCloudInfrastructure/Services/BackgroundWorkerService.cs @@ -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 ? + } } }