Skip to content

Commit 806ff68

Browse files
committed
Adding question limit
1 parent 3fdf3a1 commit 806ff68

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/help/HelpThreadOverviewUpdater.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public final class HelpThreadOverviewUpdater extends MessageReceiverAdapter impl
3232
private static final Logger logger = LoggerFactory.getLogger(HelpThreadOverviewUpdater.class);
3333

3434
private static final String STATUS_TITLE = "Active questions";
35+
private static final int OVERVIEW_QUESTION_LIMIT = 150;
3536

3637
private final HelpSystemHelper helper;
3738
private final List<String> allCategories;
@@ -148,6 +149,7 @@ private void updateOverview(@NotNull IThreadContainer stagingChannel,
148149

149150
return activeThreads.stream()
150151
.sorted(Comparator.comparing(ThreadChannel::getTimeCreated).reversed())
152+
.limit(OVERVIEW_QUESTION_LIMIT)
151153
.collect(Collectors
152154
.groupingBy(thread -> helper.getCategoryOfChannel(thread).orElse("Uncategorized")))
153155
.entrySet()

0 commit comments

Comments
 (0)