Skip to content

Commit b46db57

Browse files
Merge pull request #368 from Java-Discord/dynxsty/fix-qotw
Fixed non-`final` ExecutorService
2 parents 67d32b7 + a6470ac commit b46db57

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/main/java/net/javadiscord/javabot/systems/qotw/QOTWUserReminderJob.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import lombok.RequiredArgsConstructor;
2121

2222
import java.util.List;
23+
import java.util.concurrent.ExecutorService;
2324

2425
/**
2526
* Checks that there's a question in the QOTW queue ready for posting soon.
@@ -33,6 +34,7 @@ public class QOTWUserReminderJob {
3334
private final DbHelper dbHelper;
3435
private final QOTWSubmissionRepository qotwSubmissionRepository;
3536
private final QuestionQueueRepository questionQueueRepository;
37+
private final ExecutorService asyncPool;
3638

3739
/**
3840
* Checks that there's a question in the QOTW queue ready for posting soon.
@@ -41,7 +43,7 @@ public class QOTWUserReminderJob {
4143
public void execute() {
4244
for (Guild guild : jda.getGuilds()) {
4345
QOTWConfig config = botConfig.get(guild).getQotwConfig();
44-
List<QOTWSubmission> submissions = new SubmissionManager(config, dbHelper, qotwSubmissionRepository, questionQueueRepository).getActiveSubmissionThreads(guild.getIdLong());
46+
List<QOTWSubmission> submissions = new SubmissionManager(config, dbHelper, qotwSubmissionRepository, questionQueueRepository, asyncPool).getActiveSubmissionThreads(guild.getIdLong());
4547
for (QOTWSubmission submission : submissions) {
4648
UserPreference preference = userPreferenceService.getOrCreate(submission.getAuthorId(), Preference.QOTW_REMINDER);
4749
if (Boolean.parseBoolean(preference.getState())) {

src/main/java/net/javadiscord/javabot/systems/qotw/submissions/SubmissionInteractionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class SubmissionInteractionManager implements ButtonHandler, SelectMenuHa
4242

4343
@Override
4444
public void handleButton(@NotNull ButtonInteractionEvent event, Button button) {
45-
SubmissionManager manager = new SubmissionManager(botConfig.get(event.getGuild()).getQotwConfig(), dbHelper, qotwSubmissionRepository, questionQueueRepository);
45+
SubmissionManager manager = new SubmissionManager(botConfig.get(event.getGuild()).getQotwConfig(), dbHelper, qotwSubmissionRepository, questionQueueRepository, asyncPool);
4646
String[] id = ComponentIdBuilder.split(event.getComponentId());
4747
switch (id[1]) {
4848
case "controls" -> handleControlButtons(id, event);

src/main/java/net/javadiscord/javabot/systems/qotw/submissions/SubmissionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class SubmissionManager {
4444
private final DbHelper dbHelper;
4545
private final QOTWSubmissionRepository qotwSubmissionRepository;
4646
private final QuestionQueueRepository questionQueueRepository;
47-
private ExecutorService asyncPool;
47+
private final ExecutorService asyncPool;
4848

4949
/**
5050
* Handles the "Submit your Answer" Button interaction.

0 commit comments

Comments
 (0)