Removed ResponseCache invalidation calls

This commit is contained in:
Rsl1122 2019-08-31 10:59:08 +03:00
parent fbdf6dbb45
commit d47dccc0f7
12 changed files with 17 additions and 142 deletions

View File

@ -17,7 +17,6 @@
package com.djrapitops.plan; package com.djrapitops.plan;
import com.djrapitops.plan.delivery.upkeep.PeriodicServerExportTask; import com.djrapitops.plan.delivery.upkeep.PeriodicServerExportTask;
import com.djrapitops.plan.delivery.upkeep.PlayersPageRefreshTask;
import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask; import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask;
import com.djrapitops.plan.gathering.ShutdownHook; import com.djrapitops.plan.gathering.ShutdownHook;
import com.djrapitops.plan.gathering.timed.BukkitPingCounter; import com.djrapitops.plan.gathering.timed.BukkitPingCounter;
@ -53,7 +52,6 @@ public class BukkitTaskSystem extends TaskSystem {
private final ShutdownHook shutdownHook; private final ShutdownHook shutdownHook;
private final PeriodicServerExportTask periodicServerExportTask; private final PeriodicServerExportTask periodicServerExportTask;
private final LogsFolderCleanTask logsFolderCleanTask; private final LogsFolderCleanTask logsFolderCleanTask;
private final PlayersPageRefreshTask playersPageRefreshTask;
private final BukkitPingCounter pingCounter; private final BukkitPingCounter pingCounter;
private final ConfigStoreTask configStoreTask; private final ConfigStoreTask configStoreTask;
private final DBCleanTask dbCleanTask; private final DBCleanTask dbCleanTask;
@ -76,8 +74,7 @@ public class BukkitTaskSystem extends TaskSystem {
ConfigStoreTask configStoreTask, ConfigStoreTask configStoreTask,
DBCleanTask dbCleanTask, DBCleanTask dbCleanTask,
PeriodicServerExportTask periodicServerExportTask, PeriodicServerExportTask periodicServerExportTask
PlayersPageRefreshTask playersPageRefreshTask
) { ) {
super(runnableFactory); super(runnableFactory);
this.plugin = plugin; this.plugin = plugin;
@ -93,7 +90,6 @@ public class BukkitTaskSystem extends TaskSystem {
this.dbCleanTask = dbCleanTask; this.dbCleanTask = dbCleanTask;
this.periodicServerExportTask = periodicServerExportTask; this.periodicServerExportTask = periodicServerExportTask;
this.playersPageRefreshTask = playersPageRefreshTask;
} }
@Override @Override
@ -119,8 +115,6 @@ public class BukkitTaskSystem extends TaskSystem {
if (config.get(ExportSettings.SERVER_PAGE)) { if (config.get(ExportSettings.SERVER_PAGE)) {
registerTask(periodicServerExportTask).runTaskTimerAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS), TimeAmount.toTicks(20L, TimeUnit.MINUTES)); registerTask(periodicServerExportTask).runTaskTimerAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS), TimeAmount.toTicks(20L, TimeUnit.MINUTES));
} }
registerTask(playersPageRefreshTask)
.runTaskTimerAsynchronously(TimeAmount.toTicks(5L, TimeUnit.MINUTES), TimeAmount.toTicks(5L, TimeUnit.MINUTES));
} }
private void registerTPSCounter() { private void registerTPSCounter() {

View File

@ -181,7 +181,7 @@ public class PlayerOnlineListener implements Listener {
(uuid, name) -> name.equals(nicknameCache.getDisplayName(uuid)) (uuid, name) -> name.equals(nicknameCache.getDisplayName(uuid))
)); ));
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submitNonCritical(processors.info().playerPageExportProcessor(playerUUID));
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN)); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
} }
@ -219,6 +219,6 @@ public class PlayerOnlineListener implements Listener {
sessionCache.endSession(playerUUID, time) sessionCache.endSession(playerUUID, time)
.ifPresent(endedSession -> dbSystem.getDatabase().executeTransaction(new SessionEndTransaction(endedSession))); .ifPresent(endedSession -> dbSystem.getDatabase().executeTransaction(new SessionEndTransaction(endedSession)));
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package com.djrapitops.plan; package com.djrapitops.plan;
import com.djrapitops.plan.delivery.upkeep.NetworkPageRefreshTask;
import com.djrapitops.plan.delivery.upkeep.PlayersPageRefreshTask;
import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask; import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask;
import com.djrapitops.plan.gathering.timed.BungeePingCounter; import com.djrapitops.plan.gathering.timed.BungeePingCounter;
import com.djrapitops.plan.gathering.timed.BungeeTPSCounter; import com.djrapitops.plan.gathering.timed.BungeeTPSCounter;
@ -45,10 +43,8 @@ public class BungeeTaskSystem extends TaskSystem {
private final PlanBungee plugin; private final PlanBungee plugin;
private final PlanConfig config; private final PlanConfig config;
private final BungeeTPSCounter tpsCounter; private final BungeeTPSCounter tpsCounter;
private final NetworkPageRefreshTask networkPageRefreshTask;
private final BungeePingCounter pingCounter; private final BungeePingCounter pingCounter;
private final LogsFolderCleanTask logsFolderCleanTask; private final LogsFolderCleanTask logsFolderCleanTask;
private final PlayersPageRefreshTask playersPageRefreshTask;
private final NetworkConfigStoreTask networkConfigStoreTask; private final NetworkConfigStoreTask networkConfigStoreTask;
private final DBCleanTask dbCleanTask; private final DBCleanTask dbCleanTask;
private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask; private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask;
@ -59,10 +55,8 @@ public class BungeeTaskSystem extends TaskSystem {
PlanConfig config, PlanConfig config,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
BungeeTPSCounter tpsCounter, BungeeTPSCounter tpsCounter,
NetworkPageRefreshTask networkPageRefreshTask,
BungeePingCounter pingCounter, BungeePingCounter pingCounter,
LogsFolderCleanTask logsFolderCleanTask, LogsFolderCleanTask logsFolderCleanTask,
PlayersPageRefreshTask playersPageRefreshTask,
NetworkConfigStoreTask networkConfigStoreTask, NetworkConfigStoreTask networkConfigStoreTask,
DBCleanTask dbCleanTask, DBCleanTask dbCleanTask,
ExtensionServerMethodCallerTask extensionServerMethodCallerTask ExtensionServerMethodCallerTask extensionServerMethodCallerTask
@ -72,10 +66,8 @@ public class BungeeTaskSystem extends TaskSystem {
this.config = config; this.config = config;
this.tpsCounter = tpsCounter; this.tpsCounter = tpsCounter;
this.networkPageRefreshTask = networkPageRefreshTask;
this.pingCounter = pingCounter; this.pingCounter = pingCounter;
this.logsFolderCleanTask = logsFolderCleanTask; this.logsFolderCleanTask = logsFolderCleanTask;
this.playersPageRefreshTask = playersPageRefreshTask;
this.networkConfigStoreTask = networkConfigStoreTask; this.networkConfigStoreTask = networkConfigStoreTask;
this.dbCleanTask = dbCleanTask; this.dbCleanTask = dbCleanTask;
this.extensionServerMethodCallerTask = extensionServerMethodCallerTask; this.extensionServerMethodCallerTask = extensionServerMethodCallerTask;
@ -88,7 +80,6 @@ public class BungeeTaskSystem extends TaskSystem {
private void registerTasks() { private void registerTasks() {
registerTask(tpsCounter).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS)); registerTask(tpsCounter).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(1500, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS)); registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
Long pingDelay = config.get(TimeSettings.PING_SERVER_ENABLE_DELAY); Long pingDelay = config.get(TimeSettings.PING_SERVER_ENABLE_DELAY);
@ -98,9 +89,6 @@ public class BungeeTaskSystem extends TaskSystem {
registerTask(pingCounter).runTaskTimer(startDelay, 40L); registerTask(pingCounter).runTaskTimer(startDelay, 40L);
} }
registerTask(playersPageRefreshTask)
.runTaskTimerAsynchronously(TimeAmount.toTicks(5L, TimeUnit.MINUTES), TimeAmount.toTicks(5L, TimeUnit.MINUTES));
// +40 ticks / 2 seconds so that update check task runs first. // +40 ticks / 2 seconds so that update check task runs first.
long storeDelay = TimeAmount.toTicks(config.get(TimeSettings.CONFIG_UPDATE_INTERVAL), TimeUnit.MILLISECONDS) + 40; long storeDelay = TimeAmount.toTicks(config.get(TimeSettings.CONFIG_UPDATE_INTERVAL), TimeUnit.MILLISECONDS) + 40;
registerTask(networkConfigStoreTask).runTaskLaterAsynchronously(storeDelay); registerTask(networkConfigStoreTask).runTaskLaterAsynchronously(storeDelay);

View File

@ -19,8 +19,6 @@ package com.djrapitops.plan.gathering.listeners.bungee;
import com.djrapitops.plan.delivery.domain.keys.SessionKeys; import com.djrapitops.plan.delivery.domain.keys.SessionKeys;
import com.djrapitops.plan.delivery.webserver.cache.DataID; import com.djrapitops.plan.delivery.webserver.cache.DataID;
import com.djrapitops.plan.delivery.webserver.cache.JSONCache; import com.djrapitops.plan.delivery.webserver.cache.JSONCache;
import com.djrapitops.plan.delivery.webserver.cache.PageId;
import com.djrapitops.plan.delivery.webserver.cache.ResponseCache;
import com.djrapitops.plan.extension.CallEvents; import com.djrapitops.plan.extension.CallEvents;
import com.djrapitops.plan.extension.ExtensionServiceImplementation; import com.djrapitops.plan.extension.ExtensionServiceImplementation;
import com.djrapitops.plan.gathering.cache.GeolocationCache; import com.djrapitops.plan.gathering.cache.GeolocationCache;
@ -118,7 +116,7 @@ public class PlayerOnlineListener implements Listener {
} }
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName)); database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN)); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
UUID serverUUID = serverInfo.getServerUUID(); UUID serverUUID = serverInfo.getServerUUID();
@ -149,8 +147,7 @@ public class PlayerOnlineListener implements Listener {
UUID playerUUID = player.getUniqueId(); UUID playerUUID = player.getUniqueId();
sessionCache.endSession(playerUUID, System.currentTimeMillis()); sessionCache.endSession(playerUUID, System.currentTimeMillis());
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID())); // TODO Swap to clearing data after creating JSON cache.
processing.submit(() -> { processing.submit(() -> {
JSONCache.invalidateMatching( JSONCache.invalidateMatching(
@ -189,7 +186,7 @@ public class PlayerOnlineListener implements Listener {
Session session = new Session(playerUUID, serverInfo.getServerUUID(), time, null, null); Session session = new Session(playerUUID, serverInfo.getServerUUID(), time, null, null);
session.putRawData(SessionKeys.SERVER_NAME, "Proxy Server"); session.putRawData(SessionKeys.SERVER_NAME, "Proxy Server");
sessionCache.cacheSession(playerUUID, session); sessionCache.cacheSession(playerUUID, session);
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
JSONCache.invalidate(DataID.SERVERS); JSONCache.invalidate(DataID.SERVERS);
} }

View File

@ -1,41 +0,0 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.plan.delivery.upkeep;
import com.djrapitops.plan.delivery.webserver.cache.PageId;
import com.djrapitops.plan.delivery.webserver.cache.ResponseCache;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plugin.task.AbsRunnable;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class NetworkPageRefreshTask extends AbsRunnable {
private final ServerInfo serverInfo;
@Inject
public NetworkPageRefreshTask(ServerInfo serverInfo) {
this.serverInfo = serverInfo;
}
@Override
public void run() {
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
}
}

View File

@ -1,38 +0,0 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.plan.delivery.upkeep;
import com.djrapitops.plan.delivery.webserver.cache.PageId;
import com.djrapitops.plan.delivery.webserver.cache.ResponseCache;
import com.djrapitops.plugin.task.AbsRunnable;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class PlayersPageRefreshTask extends AbsRunnable {
@Inject
public PlayersPageRefreshTask() {
// Inject constructor required for dagger
}
@Override
public void run() {
ResponseCache.clearResponse(PageId.PLAYERS.id());
}
}

View File

@ -48,8 +48,8 @@ public class InfoProcessors {
this.jsonExport = jsonExport; this.jsonExport = jsonExport;
} }
// TODO Move // TODO Remove after Export has been rewritten to have update methods
public PlayerPageUpdateProcessor playerPageUpdateProcessor(UUID uuid) { public PlayerPageExportProcessor playerPageExportProcessor(UUID uuid) {
return new PlayerPageUpdateProcessor(uuid, config.get(), htmlExport.get(), jsonExport.get()); return new PlayerPageExportProcessor(uuid, config.get(), htmlExport.get(), jsonExport.get());
} }
} }

View File

@ -18,14 +18,12 @@ package com.djrapitops.plan.processing.processors.info;
import com.djrapitops.plan.delivery.export.HtmlExport; import com.djrapitops.plan.delivery.export.HtmlExport;
import com.djrapitops.plan.delivery.export.JSONExport; import com.djrapitops.plan.delivery.export.JSONExport;
import com.djrapitops.plan.delivery.webserver.cache.PageId;
import com.djrapitops.plan.delivery.webserver.cache.ResponseCache;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.ExportSettings; import com.djrapitops.plan.settings.config.paths.ExportSettings;
import java.util.UUID; import java.util.UUID;
public class PlayerPageUpdateProcessor implements Runnable { public class PlayerPageExportProcessor implements Runnable {
private final UUID playerUUID; private final UUID playerUUID;
@ -33,7 +31,7 @@ public class PlayerPageUpdateProcessor implements Runnable {
private final HtmlExport htmlExport; private final HtmlExport htmlExport;
private final JSONExport jsonExport; private final JSONExport jsonExport;
PlayerPageUpdateProcessor( PlayerPageExportProcessor(
UUID playerUUID, UUID playerUUID,
PlanConfig config, PlanConfig config,
HtmlExport htmlExport, HtmlExport htmlExport,
@ -47,8 +45,6 @@ public class PlayerPageUpdateProcessor implements Runnable {
@Override @Override
public void run() { public void run() {
ResponseCache.clearResponse(PageId.PLAYER.of(playerUUID));
if (config.get(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) { if (config.get(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) {
if (config.get(ExportSettings.PLAYER_JSON)) { if (config.get(ExportSettings.PLAYER_JSON)) {
jsonExport.exportPlayerJSON(playerUUID); jsonExport.exportPlayerJSON(playerUUID);

View File

@ -17,7 +17,6 @@
package com.djrapitops.plan; package com.djrapitops.plan;
import com.djrapitops.plan.delivery.upkeep.PeriodicServerExportTask; import com.djrapitops.plan.delivery.upkeep.PeriodicServerExportTask;
import com.djrapitops.plan.delivery.upkeep.PlayersPageRefreshTask;
import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask; import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask;
import com.djrapitops.plan.gathering.ShutdownHook; import com.djrapitops.plan.gathering.ShutdownHook;
import com.djrapitops.plan.gathering.timed.SpongePingCounter; import com.djrapitops.plan.gathering.timed.SpongePingCounter;
@ -48,7 +47,6 @@ public class SpongeTaskSystem extends TaskSystem {
private final PeriodicServerExportTask periodicServerExportTask; private final PeriodicServerExportTask periodicServerExportTask;
private final SpongePingCounter pingCounter; private final SpongePingCounter pingCounter;
private final LogsFolderCleanTask logsFolderCleanTask; private final LogsFolderCleanTask logsFolderCleanTask;
private final PlayersPageRefreshTask playersPageRefreshTask;
private final ConfigStoreTask configStoreTask; private final ConfigStoreTask configStoreTask;
private final DBCleanTask dbCleanTask; private final DBCleanTask dbCleanTask;
private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask; private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask;
@ -68,8 +66,7 @@ public class SpongeTaskSystem extends TaskSystem {
ConfigStoreTask configStoreTask, ConfigStoreTask configStoreTask,
DBCleanTask dbCleanTask, DBCleanTask dbCleanTask,
PeriodicServerExportTask periodicServerExportTask, PeriodicServerExportTask periodicServerExportTask
PlayersPageRefreshTask playersPageRefreshTask
) { ) {
super(runnableFactory); super(runnableFactory);
this.plugin = plugin; this.plugin = plugin;
@ -85,7 +82,6 @@ public class SpongeTaskSystem extends TaskSystem {
this.dbCleanTask = dbCleanTask; this.dbCleanTask = dbCleanTask;
this.periodicServerExportTask = periodicServerExportTask; this.periodicServerExportTask = periodicServerExportTask;
this.playersPageRefreshTask = playersPageRefreshTask;
} }
@Override @Override
@ -111,8 +107,6 @@ public class SpongeTaskSystem extends TaskSystem {
if (config.get(ExportSettings.SERVER_PAGE)) { if (config.get(ExportSettings.SERVER_PAGE)) {
registerTask(periodicServerExportTask).runTaskTimerAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS), TimeAmount.toTicks(20L, TimeUnit.MINUTES)); registerTask(periodicServerExportTask).runTaskTimerAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS), TimeAmount.toTicks(20L, TimeUnit.MINUTES));
} }
registerTask(playersPageRefreshTask)
.runTaskTimerAsynchronously(TimeAmount.toTicks(5L, TimeUnit.MINUTES), TimeAmount.toTicks(5L, TimeUnit.MINUTES));
} }
private void registerTPSCounter() { private void registerTPSCounter() {

View File

@ -185,7 +185,7 @@ public class PlayerOnlineListener {
(uuid, name) -> name.equals(nicknameCache.getDisplayName(uuid)) (uuid, name) -> name.equals(nicknameCache.getDisplayName(uuid))
)); ));
processing.submitNonCritical(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submitNonCritical(processors.info().playerPageExportProcessor(playerUUID));
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN)); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
} }
@ -224,6 +224,6 @@ public class PlayerOnlineListener {
sessionCache.endSession(playerUUID, time) sessionCache.endSession(playerUUID, time)
.ifPresent(endedSession -> dbSystem.getDatabase().executeTransaction(new SessionEndTransaction(endedSession))); .ifPresent(endedSession -> dbSystem.getDatabase().executeTransaction(new SessionEndTransaction(endedSession)));
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package com.djrapitops.plan; package com.djrapitops.plan;
import com.djrapitops.plan.delivery.upkeep.NetworkPageRefreshTask;
import com.djrapitops.plan.delivery.upkeep.PlayersPageRefreshTask;
import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask; import com.djrapitops.plan.extension.ExtensionServerMethodCallerTask;
import com.djrapitops.plan.gathering.timed.VelocityPingCounter; import com.djrapitops.plan.gathering.timed.VelocityPingCounter;
import com.djrapitops.plan.gathering.timed.VelocityTPSCounter; import com.djrapitops.plan.gathering.timed.VelocityTPSCounter;
@ -45,10 +43,8 @@ public class VelocityTaskSystem extends TaskSystem {
private final PlanVelocity plugin; private final PlanVelocity plugin;
private final PlanConfig config; private final PlanConfig config;
private final VelocityTPSCounter tpsCounter; private final VelocityTPSCounter tpsCounter;
private final NetworkPageRefreshTask networkPageRefreshTask;
private final VelocityPingCounter pingCounter; private final VelocityPingCounter pingCounter;
private final LogsFolderCleanTask logsFolderCleanTask; private final LogsFolderCleanTask logsFolderCleanTask;
private final PlayersPageRefreshTask playersPageRefreshTask;
private final NetworkConfigStoreTask networkConfigStoreTask; private final NetworkConfigStoreTask networkConfigStoreTask;
private final DBCleanTask dbCleanTask; private final DBCleanTask dbCleanTask;
private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask; private final ExtensionServerMethodCallerTask extensionServerMethodCallerTask;
@ -59,10 +55,8 @@ public class VelocityTaskSystem extends TaskSystem {
PlanConfig config, PlanConfig config,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
VelocityTPSCounter tpsCounter, VelocityTPSCounter tpsCounter,
NetworkPageRefreshTask networkPageRefreshTask,
VelocityPingCounter pingCounter, VelocityPingCounter pingCounter,
LogsFolderCleanTask logsFolderCleanTask, LogsFolderCleanTask logsFolderCleanTask,
PlayersPageRefreshTask playersPageRefreshTask,
NetworkConfigStoreTask networkConfigStoreTask, NetworkConfigStoreTask networkConfigStoreTask,
DBCleanTask dbCleanTask, DBCleanTask dbCleanTask,
ExtensionServerMethodCallerTask extensionServerMethodCallerTask ExtensionServerMethodCallerTask extensionServerMethodCallerTask
@ -72,9 +66,7 @@ public class VelocityTaskSystem extends TaskSystem {
this.config = config; this.config = config;
this.tpsCounter = tpsCounter; this.tpsCounter = tpsCounter;
this.pingCounter = pingCounter; this.pingCounter = pingCounter;
this.networkPageRefreshTask = networkPageRefreshTask;
this.logsFolderCleanTask = logsFolderCleanTask; this.logsFolderCleanTask = logsFolderCleanTask;
this.playersPageRefreshTask = playersPageRefreshTask;
this.networkConfigStoreTask = networkConfigStoreTask; this.networkConfigStoreTask = networkConfigStoreTask;
this.dbCleanTask = dbCleanTask; this.dbCleanTask = dbCleanTask;
this.extensionServerMethodCallerTask = extensionServerMethodCallerTask; this.extensionServerMethodCallerTask = extensionServerMethodCallerTask;
@ -87,7 +79,6 @@ public class VelocityTaskSystem extends TaskSystem {
private void registerTasks() { private void registerTasks() {
registerTask(tpsCounter).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS)); registerTask(tpsCounter).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(1500, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS)); registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
Long pingDelay = config.get(TimeSettings.PING_SERVER_ENABLE_DELAY); Long pingDelay = config.get(TimeSettings.PING_SERVER_ENABLE_DELAY);
@ -97,8 +88,6 @@ public class VelocityTaskSystem extends TaskSystem {
registerTask(pingCounter).runTaskTimer(startDelay, 40L); registerTask(pingCounter).runTaskTimer(startDelay, 40L);
} }
registerTask(playersPageRefreshTask).runTaskTimerAsynchronously(TimeAmount.toTicks(5L, TimeUnit.MINUTES), TimeAmount.toTicks(5L, TimeUnit.MINUTES));
// +40 ticks / 2 seconds so that update check task runs first. // +40 ticks / 2 seconds so that update check task runs first.
long storeDelay = TimeAmount.toTicks(config.get(TimeSettings.CONFIG_UPDATE_INTERVAL), TimeUnit.MILLISECONDS) + 40; long storeDelay = TimeAmount.toTicks(config.get(TimeSettings.CONFIG_UPDATE_INTERVAL), TimeUnit.MILLISECONDS) + 40;
registerTask(networkConfigStoreTask).runTaskLaterAsynchronously(storeDelay); registerTask(networkConfigStoreTask).runTaskLaterAsynchronously(storeDelay);

View File

@ -18,8 +18,6 @@ package com.djrapitops.plan.gathering.listeners.velocity;
import com.djrapitops.plan.delivery.webserver.cache.DataID; import com.djrapitops.plan.delivery.webserver.cache.DataID;
import com.djrapitops.plan.delivery.webserver.cache.JSONCache; import com.djrapitops.plan.delivery.webserver.cache.JSONCache;
import com.djrapitops.plan.delivery.webserver.cache.PageId;
import com.djrapitops.plan.delivery.webserver.cache.ResponseCache;
import com.djrapitops.plan.extension.CallEvents; import com.djrapitops.plan.extension.CallEvents;
import com.djrapitops.plan.extension.ExtensionServiceImplementation; import com.djrapitops.plan.extension.ExtensionServiceImplementation;
import com.djrapitops.plan.gathering.cache.GeolocationCache; import com.djrapitops.plan.gathering.cache.GeolocationCache;
@ -119,9 +117,8 @@ public class PlayerOnlineListener {
} }
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName)); database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN)); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN));
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
UUID serverUUID = serverInfo.getServerUUID(); UUID serverUUID = serverInfo.getServerUUID();
JSONCache.invalidateMatching(DataID.SERVER_OVERVIEW); JSONCache.invalidateMatching(DataID.SERVER_OVERVIEW);
@ -151,8 +148,7 @@ public class PlayerOnlineListener {
UUID playerUUID = player.getUniqueId(); UUID playerUUID = player.getUniqueId();
sessionCache.endSession(playerUUID, System.currentTimeMillis()); sessionCache.endSession(playerUUID, System.currentTimeMillis());
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
processing.submit(() -> { processing.submit(() -> {
JSONCache.invalidateMatching( JSONCache.invalidateMatching(
@ -190,7 +186,7 @@ public class PlayerOnlineListener {
// Replaces the current session in the cache. // Replaces the current session in the cache.
sessionCache.cacheSession(playerUUID, new Session(playerUUID, serverInfo.getServerUUID(), time, null, null)); sessionCache.cacheSession(playerUUID, new Session(playerUUID, serverInfo.getServerUUID(), time, null, null));
processing.submit(processors.info().playerPageUpdateProcessor(playerUUID)); processing.submit(processors.info().playerPageExportProcessor(playerUUID));
JSONCache.invalidate(DataID.SERVERS); JSONCache.invalidate(DataID.SERVERS);
} }