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 6c8d1d9 commit e2a6f74
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions Conductor/Client/Worker/WorkflowTaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,33 @@ private async void WorkOnce(CancellationToken token)
return new List<Task>();
}

var tasks = _taskClient.PollTask(_worker.TaskType, _workerSettings.WorkerId, _workerSettings.Domain,
availableWorkerCounter);
if (tasks == null)
try
{
tasks = new List<Models.Task>();
}
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;
_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<Task>();
}
}

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

0 comments on commit e2a6f74

Please sign in to comment.