Skip to content

Commit c12f1a3

Browse files
Removed unused connection
1 parent b9fe057 commit c12f1a3

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class QOTWPointsService {
2828
*
2929
* @param userId The user's id.
3030
* @return An {@link QOTWAccount} object.
31-
* @throws SQLException If an error occurs.
31+
* @throws DataAccessException If an error occurs.
3232
*/
3333
@Transactional
3434
public QOTWAccount getOrCreateAccount(long userId) throws DataAccessException {

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,11 @@ public class QOTWReminderJob {
3939
public void execute() throws SQLException {
4040
for (Guild guild : jda.getGuilds()) {
4141
ModerationConfig config = botConfig.get(guild).getModerationConfig();
42-
try (Connection c = dataSource.getConnection()) {
43-
Optional<QOTWQuestion> q = questionQueueRepository.getNextQuestion(guild.getIdLong());
44-
if (q.isEmpty()) {
45-
notificationService.withGuild(guild).sendToModerationLog(m -> m.sendMessageFormat(
46-
"Warning! %s There's no Question of the Week in the queue. Please add one before it's time to post!",
47-
config.getStaffRole().getAsMention()));
48-
}
49-
} catch (SQLException e) {
50-
ExceptionLogger.capture(e, getClass().getSimpleName());
51-
notificationService.withGuild(guild).sendToModerationLog(c -> c.sendMessageFormat(
52-
"Warning! %s Could not check to see if there's a question in the QOTW queue:\n```\n%s\n```\n",
53-
config.getStaffRole().getAsMention(), e.getMessage()));
54-
throw e;
42+
Optional<QOTWQuestion> q = questionQueueRepository.getNextQuestion(guild.getIdLong());
43+
if (q.isEmpty()) {
44+
notificationService.withGuild(guild).sendToModerationLog(m -> m.sendMessageFormat(
45+
"Warning! %s There's no Question of the Week in the queue. Please add one before it's time to post!",
46+
config.getStaffRole().getAsMention()));
5547
}
5648
}
5749
}

0 commit comments

Comments
 (0)