Potential fix for loss of data due to SQL connection dropping

The idea behind this change is to send a ping every hour, which is shorter than the driver's 'dead connection' threshold of 8 hours.

As a side effect, this also will fix a subset of the situations where the MySQL server is restarted.
This commit is contained in:
riking
2013-10-05 14:55:34 -07:00
committed by TfT_02
parent c19ccbccac
commit f75fe3cc89
2 changed files with 42 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.database.SQLReconnectTask;
import com.gmail.nossr50.runnables.database.SQLDatabaseKeepaliveTask;
import com.gmail.nossr50.util.Misc;
public final class SQLDatabaseManager implements DatabaseManager {
@ -51,6 +52,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
protected SQLDatabaseManager() {
checkStructure();
new SQLDatabaseKeepaliveTask(this).runTaskTimerAsynchronously(mcMMO.p, 10, 60L * 60 * Misc.TICK_CONVERSION_FACTOR);
}
public void purgePowerlessUsers() {