Skip to content

Commit

Permalink
Update WorkflowTaskExecutor.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r3n committed Jan 2, 2024
1 parent 3f8b849 commit 286ce54
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions Conductor/Client/Worker/WorkflowTaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,30 @@ private async void WorkOnce(CancellationToken token)
_logger.LogDebug("All workers are busy");
return new List<Task>();
}
var tasks = _taskClient.PollTask(_worker.TaskType, _workerSettings.WorkerId, _workerSettings.Domain, availableWorkerCounter);
if (tasks == null)

try
{
var tasks = _taskClient.PollTask(_worker.TaskType, _workerSettings.WorkerId, _workerSettings.Domain,
availableWorkerCounter);
if (tasks == null)
{
tasks = new List<Models.Task>();
}

_logger.LogTrace(
$"[{_workerSettings.WorkerId}] Polled {tasks.Count} tasks"
+ $", taskType: {_worker.TaskType}"
+ $", domain: {_workerSettings.Domain}"
+ $", batchSize: {_workerSettings.BatchSize}"
);
return tasks;
}
catch (Exception e)
{
tasks = new List<Models.Task>();
_logger.LogError($"Error polling for {_worker.TaskType}. Error = {e.Message}");
return new List<Task>();
}
_logger.LogTrace(
$"[{_workerSettings.WorkerId}] Polled {tasks.Count} tasks"
+ $", taskType: {_worker.TaskType}"
+ $", domain: {_workerSettings.Domain}"
+ $", batchSize: {_workerSettings.BatchSize}"
);
return tasks;

}

private async void ProcessTasks(List<Models.Task> tasks, CancellationToken token)
Expand Down

0 comments on commit 286ce54

Please sign in to comment.