diff --git a/Conductor/Client/Worker/WorkflowTaskExecutor.cs b/Conductor/Client/Worker/WorkflowTaskExecutor.cs index 5a41137b..c9b54473 100644 --- a/Conductor/Client/Worker/WorkflowTaskExecutor.cs +++ b/Conductor/Client/Worker/WorkflowTaskExecutor.cs @@ -142,20 +142,33 @@ private async void WorkOnce(CancellationToken token) return new List(); } - var tasks = _taskClient.PollTask(_worker.TaskType, _workerSettings.WorkerId, _workerSettings.Domain, - availableWorkerCounter); - if (tasks == null) + try { - tasks = new List(); - } + var tasks = _taskClient.PollTask(_worker.TaskType, _workerSettings.WorkerId, _workerSettings.Domain, + availableWorkerCounter); + if (tasks == null) + { + tasks = new List(); + } - _logger.LogTrace( - $"[{_workerSettings.WorkerId}] Polled {tasks.Count} tasks" - + $", taskType: {_worker.TaskType}" - + $", domain: {_workerSettings.Domain}" - + $", batchSize: {_workerSettings.BatchSize}" - ); - return tasks; + _logger.LogTrace( + $"[{_workerSettings.WorkerId}] Polled {tasks.Count} tasks" + + $", taskType: {_worker.TaskType}" + + $", domain: {_workerSettings.Domain}" + + $", batchSize: {_workerSettings.BatchSize}" + ); + return tasks; + } + catch (Exception e) + { + _logger.LogTrace( + $"[{_workerSettings.WorkerId}] Polling error: {e.Message} " + + $", taskType: {_worker.TaskType}" + + $", domain: {_workerSettings.Domain}" + + $", batchSize: {_workerSettings.BatchSize}" + ); + return new List(); + } } private async void ProcessTasks(List tasks, CancellationToken token)