Skip to content

Commit

Permalink
Merge pull request #2160 from HubSpot/more_efficient_active_tasks
Browse files Browse the repository at this point in the history
More efficient active tasks for request listing
  • Loading branch information
ssalinas authored Jan 4, 2021
2 parents 43cb189 + d37435f commit 684cd2b
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -999,18 +999,14 @@ private List<SingularityTaskId> getTaskIdsForRequest(
String requestId,
TaskFilter taskFilter
) {
final List<SingularityTaskId> activeTaskIds = getChildrenAsIds(
getLastActiveTaskParent(requestId),
taskIdTranscoder
);
if (taskFilter == TaskFilter.ACTIVE) {
if (leaderCache.active()) {
return leaderCache.getActiveTaskIdsForRequest(requestId);
} else {
return getActiveTaskIds()
.stream()
.filter(t -> t.getRequestId().equals(requestId))
.collect(Collectors.toList());
}
return activeTaskIds;
}
final List<SingularityTaskId> requestTaskIds = getTaskIdsForRequest(requestId);
final List<SingularityTaskId> activeTaskIds = filterActiveTaskIds(requestTaskIds);
Iterables.removeAll(requestTaskIds, activeTaskIds);

return requestTaskIds;
Expand Down

0 comments on commit 684cd2b

Please sign in to comment.