This repository was archived by the owner on May 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 591
This repository was archived by the owner on May 14, 2025. It is now read-only.
Long duration time for REST List All task definition #5841
Copy link
Copy link
Closed
Labels
Description
In 2.11.2 I've noticed that getting list all task definition last very long. After analyze code, I think that I found reason - in class DefaultAggregateTaskExplorer:
TaskDefinitionController pass to getLatestTaskExecutionsByTaskNames all task definition as list - i.e. 100 definitions. But in method getLatestTaskExecutionsByTaskNames there is a loop where every element in a loop execute
List<AggregateTaskExecution> taskExecutions = taskExplorer.getLatestTaskExecutionsByTaskNames(taskNames)
but for whole list - not for one element:
taskExplorer.getLatestTaskExecutionsByTaskNames(taskNames) VS taskExplorer.getLatestTaskExecutionsByTaskNames(taskName)
@Override
public List<AggregateTaskExecution> getLatestTaskExecutionsByTaskNames(String... taskNames) {
List<AggregateTaskExecution> result = new ArrayList<>();
for (String taskName : taskNames) { // iterate over all task names
SchemaVersionTarget target = aggregateExecutionSupport.findSchemaVersionTarget(taskName, taskDefinitionReader);
String platformName = getPlatformName(taskName);
Assert.notNull(target, "Expected to find SchemaVersionTarget for " + taskName);
TaskExplorer taskExplorer = taskExplorers.get(target.getName());
Assert.notNull(taskExplorer, "Expected TaskExplorer for " + target.getName());
List<AggregateTaskExecution> taskExecutions = taskExplorer.getLatestTaskExecutionsByTaskNames(taskNames) // pass not one element but always all task names (list)
.stream()
.map(execution -> aggregateExecutionSupport.from(execution, target.getName(), platformName))
.collect(Collectors.toList());
result.addAll(taskExecutions);
}
return result;
}
Please, let me know if should be pass list or one element of list.
Reactions are currently unavailable