Skip to content

Commit

Permalink
Added refactors based on PR comments - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hr2904 committed Oct 28, 2024
1 parent 05408e0 commit 0a233e0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
public class TaskRegistry {
private static final Logger LOG = LoggerFactory.getLogger(TaskRegistry.class);
public static final int TASK_FETCH_BATCH_SIZE = 100;
public static final List<Map<String, Object>> SORT_ARRAY = Collections.singletonList(mapOf(Constants.TASK_CREATED_TIME, mapOf("order", "asc")));

private AtlasGraph graph;
private TaskService taskService;
Expand Down Expand Up @@ -137,11 +138,11 @@ public List<AtlasTask> getInProgressTasks() {
public List<AtlasTask> getInProgressTasksES() {
AtlasPerfMetrics.MetricRecorder metric = RequestContext.get().startMetricRecord("getInProgressTasksES");
List<AtlasTask> ret = new ArrayList<>();
Map<String, Object> dsl = mapOf("query", QUERY_MAP);
dsl.put("sort", SORT_ARRAY);
dsl.put("size", TASK_FETCH_BATCH_SIZE);
int from = 0;
while(true) {
Map<String, Object> dsl = mapOf("query", QUERY_MAP);
dsl.put("sort", Collections.singletonList(mapOf(Constants.TASK_CREATED_TIME, mapOf("order", "asc"))));
dsl.put("size", TASK_FETCH_BATCH_SIZE);
dsl.put("from", from);
TaskSearchParams taskSearchParams = new TaskSearchParams();
taskSearchParams.setDsl(dsl);
Expand Down

0 comments on commit 0a233e0

Please sign in to comment.