mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-09 01:47:39 +01:00
Disable database player clean on game servers when proxy is installed
Affects issues: - Close #3241
This commit is contained in:
parent
ee1f337eff
commit
8eb4a54e6e
@ -161,15 +161,21 @@ public class DBCleanTask extends TaskSystem.Task {
|
||||
|
||||
// VisibleForTesting
|
||||
public int cleanOldPlayers(Database database) {
|
||||
long now = System.currentTimeMillis();
|
||||
long keepActiveAfter = now - config.get(TimeSettings.DELETE_INACTIVE_PLAYERS_AFTER);
|
||||
// Only clean if this is a proxy server or no proxy servers are installed.
|
||||
if (serverInfo.getServer().isProxy() || database.query(ServerQueries.fetchProxyServers()).isEmpty()) {
|
||||
long now = System.currentTimeMillis();
|
||||
long keepActiveAfter = now - config.get(TimeSettings.DELETE_INACTIVE_PLAYERS_AFTER);
|
||||
|
||||
List<UUID> inactivePlayers = database.query(fetchInactivePlayerUUIDs(keepActiveAfter));
|
||||
for (UUID playerUUID : inactivePlayers) {
|
||||
queryService.playerRemoved(playerUUID);
|
||||
database.executeTransaction(new RemovePlayerTransaction(playerUUID));
|
||||
List<UUID> inactivePlayers = database.query(fetchInactivePlayerUUIDs(keepActiveAfter));
|
||||
for (UUID playerUUID : inactivePlayers) {
|
||||
queryService.playerRemoved(playerUUID);
|
||||
database.executeTransaction(new RemovePlayerTransaction(playerUUID));
|
||||
}
|
||||
return inactivePlayers.size();
|
||||
}
|
||||
return inactivePlayers.size();
|
||||
|
||||
// Skip cleaning on game servers if proxy server is installed.
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Query<List<UUID>> fetchInactivePlayerUUIDs(long keepActiveAfter) {
|
||||
|
Loading…
Reference in New Issue
Block a user