forked from ddrilling/AsbCloudServer
fix backgroundService exception handler
This commit is contained in:
parent
ae85cdedd5
commit
7f12f48cb9
@ -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 ?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user