fix: actually handle stopping the database when the bot is stopping

This commit is contained in:
ChomeNS
2024-12-14 16:54:28 +07:00
parent 6a11f237ef
commit 5a06ee53b6
3 changed files with 13 additions and 1 deletions

View File

@@ -1 +1 @@
1256
1258

View File

@@ -148,6 +148,8 @@ public class Main {
executorService.shutdown();
database.stop();
try {
final boolean ignoredExecutorDone = executor.awaitTermination(5, TimeUnit.SECONDS);
final boolean ignoredExecutorServiceDone = executorService.awaitTermination(5, TimeUnit.SECONDS);

View File

@@ -50,4 +50,14 @@ public class DatabasePlugin {
return statement.executeUpdate(query);
}
public void stop () {
executorService.shutdown();
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}