Remove unnecessary .stream() call

Add setAutoCommit(false) at the SQLite connection; Improves speed massively
This commit is contained in:
Fuzzlemann 2017-08-03 11:56:07 +02:00
parent 92e639e7b9
commit f2cfedf4c9
3 changed files with 5 additions and 3 deletions

View File

@ -50,7 +50,9 @@ public class SQLiteDB extends SQLDB {
try {
Class.forName("org.sqlite.JDBC");
return DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), dbName + ".db").getAbsolutePath());
Connection connection = DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), dbName + ".db").getAbsolutePath());
connection.setAutoCommit(false);
return connection;
} catch (ClassNotFoundException | SQLException e) {
return null;
}

View File

@ -298,7 +298,7 @@ public class GMTimesTable extends Table {
List<List<Container<GMTimes>>> batches = DBUtils.splitIntoBatchesWithID(gmTimes);
batches.stream().forEach(batch -> {
batches.forEach(batch -> {
try {
addNewGMTimesBatch(batch);
} catch (SQLException e) {

View File

@ -218,7 +218,7 @@ public class SessionsTable extends Table {
List<List<Container<SessionData>>> batches = splitIntoBatches(sessions);
batches.stream().forEach(batch -> {
batches.forEach(batch -> {
try {
saveSessionBatch(batch);
} catch (SQLException e) {