diff --git a/src/main/java/net/coreprotect/consumer/process/Process.java b/src/main/java/net/coreprotect/consumer/process/Process.java index 019d8bd..563549d 100755 --- a/src/main/java/net/coreprotect/consumer/process/Process.java +++ b/src/main/java/net/coreprotect/consumer/process/Process.java @@ -73,8 +73,10 @@ public class Process { return; } - Consumer.isPaused = true; Statement statement = connection.createStatement(); + Database.performCheckpoint(statement); + + Consumer.isPaused = true; ArrayList consumerData = Consumer.consumer.get(processId); Map users = Consumer.consumerUsers.get(processId); Map consumerObject = Consumer.consumerObjects.get(processId); diff --git a/src/main/java/net/coreprotect/database/Database.java b/src/main/java/net/coreprotect/database/Database.java index cc40a23..391692d 100755 --- a/src/main/java/net/coreprotect/database/Database.java +++ b/src/main/java/net/coreprotect/database/Database.java @@ -4,6 +4,7 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; @@ -88,6 +89,12 @@ public class Database extends Queue { } } + public static void performCheckpoint(Statement statement) throws SQLException { + if (!Config.getGlobal().MYSQL) { + statement.executeUpdate("PRAGMA wal_checkpoint(TRUNCATE)"); + } + } + public static void setMultiInt(PreparedStatement statement, int value, int count) { try { for (int i = 1; i <= count; i++) {