Skip to content

Commit 0691f43

Browse files
authored
Sort running crawls first by default (#2587)
1 parent 5915c24 commit 0691f43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backend/btrixcloud/crawlconfigs.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,13 @@ async def get_crawl_configs(
608608
if sort_by == "name":
609609
sort_query["firstSeed"] = sort_direction
610610

611-
# modified for last* fields in case crawl hasn't been run yet
611+
# Special case for last-* fields in case crawl is running
612612
elif sort_by in ("lastRun", "lastCrawlTime", "lastCrawlStartTime"):
613-
sort_query["modified"] = sort_direction
613+
sort_query = {
614+
"isCrawlRunning": sort_direction,
615+
sort_by: sort_direction,
616+
"modified": sort_direction,
617+
}
614618

615619
aggregate.extend([{"$sort": sort_query}])
616620

0 commit comments

Comments
 (0)