Fix worker overload will casue task failed

This commit is contained in:
Wenjun Ruan 2024-06-26 22:05:00 +08:00
parent e8566818b0
commit 4a41e4290e
1 changed files with 5 additions and 4 deletions

View File

@ -55,10 +55,11 @@ public abstract class BaseTaskDispatcher implements TaskDispatcher {
taskInstanceDispatchHost = getTaskInstanceDispatchHost(taskExecuteRunnable)
.orElseThrow(() -> new TaskDispatchException("Cannot find the host to execute task."));
} catch (WorkerGroupNotFoundException workerGroupNotFoundException) {
log.error("Dispatch task: {} failed, worker group not found.",
taskExecuteRunnable.getTaskExecutionContext().getTaskName(), workerGroupNotFoundException);
addDispatchFailedEvent(taskExecuteRunnable);
return;
// todo: this is a temporary solution, we should refactor the ServerNodeManager to make sure there won't
// throw WorkerGroupNotFoundException unless the worker group is not exist in database
throw new TaskDispatchException(
"Dispatch task: " + taskExecuteRunnable.getTaskExecutionContext().getTaskName() + " failed",
workerGroupNotFoundException);
}
taskExecuteRunnable.getTaskExecutionContext().setHost(taskInstanceDispatchHost.getAddress());
doDispatch(taskExecuteRunnable);