mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-21 20:22:45 +02:00
[Debt] Updated Network page updating
This moves the network page servers tab generation and removes need for network page updates on Bukkit servers, so it was removed.
This commit is contained in:
parent
d448e7f868
commit
81be032ccf
|
@ -13,9 +13,6 @@ import com.djrapitops.plan.system.info.request.InfoRequest;
|
|||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.webserver.WebServer;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import dagger.Lazy;
|
||||
|
||||
|
@ -30,22 +27,15 @@ import javax.inject.Singleton;
|
|||
@Singleton
|
||||
public class BungeeInfoSystem extends InfoSystem {
|
||||
|
||||
private final ResponseFactory responseFactory;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
@Inject
|
||||
public BungeeInfoSystem(
|
||||
InfoRequestFactory infoRequestFactory,
|
||||
ResponseFactory responseFactory,
|
||||
ConnectionSystem connectionSystem,
|
||||
ServerInfo serverInfo,
|
||||
Lazy<WebServer> webServer,
|
||||
PluginLogger logger
|
||||
) {
|
||||
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
||||
this.responseFactory = responseFactory;
|
||||
|
||||
this.serverInfo = serverInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,9 +48,4 @@ public class BungeeInfoSystem extends InfoSystem {
|
|||
throw new NoServersException("No servers were available to process this request (Local attempt): " + infoRequest.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkPage() {
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverInfo.getServerUUID()), responseFactory::networkPageResponse);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,15 +138,6 @@ public abstract class InfoSystem implements SubSystem {
|
|||
return connectionSystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates Network page.
|
||||
* <p>
|
||||
* No calls from non-async thread found on 09.02.2018
|
||||
*
|
||||
* @throws WebException If fails.
|
||||
*/
|
||||
public abstract void updateNetworkPage() throws WebException;
|
||||
|
||||
/**
|
||||
* Requests Set up from Bungee.
|
||||
* <p>
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.inject.Singleton;
|
|||
@Singleton
|
||||
public class ServerInfoSystem extends InfoSystem {
|
||||
|
||||
private final ServerInfo serverInfo;
|
||||
private final PluginLogger logger;
|
||||
|
||||
@Inject
|
||||
|
@ -39,7 +38,6 @@ public class ServerInfoSystem extends InfoSystem {
|
|||
PluginLogger logger
|
||||
) {
|
||||
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
||||
this.serverInfo = serverInfo;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
@ -51,10 +49,4 @@ public class ServerInfoSystem extends InfoSystem {
|
|||
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Local: " + infoRequest.getClass().getSimpleName());
|
||||
infoRequest.runLocally();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkPage() throws WebException {
|
||||
String html = ""; // TODO Rework this part of the info system
|
||||
sendRequest(infoRequestFactory.cacheNetworkPageContentRequest(serverInfo.getServerUUID(), html));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package com.djrapitops.plan.system.info.request;
|
|||
import com.djrapitops.plan.api.exceptions.connection.BadRequestException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
|
@ -30,6 +31,7 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||
|
||||
private final PlanConfig config;
|
||||
private final Processing processing;
|
||||
private final Processors processors;
|
||||
private final HtmlExport htmlExport;
|
||||
|
||||
private UUID serverUUID;
|
||||
|
@ -38,10 +40,12 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||
CacheAnalysisPageRequest(
|
||||
PlanConfig config,
|
||||
Processing processing,
|
||||
Processors processors,
|
||||
HtmlExport htmlExport
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
this.processors = processors;
|
||||
this.htmlExport = htmlExport;
|
||||
}
|
||||
|
||||
|
@ -49,10 +53,12 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||
UUID serverUUID, String html,
|
||||
PlanConfig config,
|
||||
Processing processing,
|
||||
Processors processors,
|
||||
HtmlExport htmlExport
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
this.processors = processors;
|
||||
this.htmlExport = htmlExport;
|
||||
|
||||
Verify.nullCheck(serverUUID, html);
|
||||
|
@ -76,6 +82,7 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||
|
||||
private void cache(UUID serverUUID, String html) {
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new AnalysisPageResponse(html));
|
||||
processing.submitNonCritical(processors.info().networkPageUpdateProcessor());
|
||||
|
||||
if (config.isTrue(Settings.ANALYSIS_EXPORT)) {
|
||||
processing.submitNonCritical(() -> htmlExport.exportServer(serverUUID));
|
||||
|
|
|
@ -83,7 +83,6 @@ public class GenerateAnalysisPageRequest extends InfoRequestWithVariables implem
|
|||
|
||||
private void generateAndCache(UUID serverUUID) throws WebException {
|
||||
infoSystem.sendRequest(infoRequestFactory.cacheAnalysisPageRequest(serverUUID, analyseAndGetHtml()));
|
||||
infoSystem.updateNetworkPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* License is provided in the jar as LICENSE also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||
*/
|
||||
package com.djrapitops.plan.system.info.request;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* InfoRequest for generating network page content of a Bukkit server.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class GenerateNetworkPageContentRequest implements WideRequest, GenerateRequest {
|
||||
|
||||
private final InfoSystem infoSystem;
|
||||
|
||||
GenerateNetworkPageContentRequest(InfoSystem infoSystem) {
|
||||
this.infoSystem = infoSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response handleRequest(Map<String, String> variables) throws WebException {
|
||||
runLocally();
|
||||
return DefaultResponses.SUCCESS.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runLocally() throws WebException {
|
||||
infoSystem.updateNetworkPage();
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.djrapitops.plan.system.info.InfoSystem;
|
|||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
|
@ -28,6 +29,7 @@ public class InfoRequestFactory {
|
|||
private final Lazy<PlanPlugin> plugin;
|
||||
private final Lazy<PlanConfig> config;
|
||||
private final Lazy<Processing> processing;
|
||||
private final Lazy<Processors> processors;
|
||||
private final Lazy<InfoSystem> infoSystem;
|
||||
private final Lazy<ConnectionSystem> connectionSystem;
|
||||
private final Lazy<ServerInfo> serverInfo;
|
||||
|
@ -43,6 +45,7 @@ public class InfoRequestFactory {
|
|||
Lazy<PlanPlugin> plugin,
|
||||
Lazy<PlanConfig> config,
|
||||
Lazy<Processing> processing,
|
||||
Lazy<Processors> processors,
|
||||
Lazy<InfoSystem> infoSystem,
|
||||
Lazy<ConnectionSystem> connectionSystem,
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
|
@ -56,6 +59,7 @@ public class InfoRequestFactory {
|
|||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
this.processors = processors;
|
||||
this.infoSystem = infoSystem;
|
||||
this.connectionSystem = connectionSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
|
@ -68,7 +72,7 @@ public class InfoRequestFactory {
|
|||
}
|
||||
|
||||
public CacheRequest cacheAnalysisPageRequest(UUID serverUUID, String html) {
|
||||
return new CacheAnalysisPageRequest(serverUUID, html, config.get(), processing.get(), htmlExport.get());
|
||||
return new CacheAnalysisPageRequest(serverUUID, html, config.get(), processing.get(), processors.get(), htmlExport.get());
|
||||
}
|
||||
|
||||
public CacheRequest cacheInspectPageRequest(UUID uuid, String html) {
|
||||
|
@ -95,10 +99,6 @@ public class InfoRequestFactory {
|
|||
return new GenerateInspectPluginsTabRequest(uuid, infoSystem.get(), this, pageFactory.get());
|
||||
}
|
||||
|
||||
public GenerateNetworkPageContentRequest generateNetworkPageContentRequest() {
|
||||
return new GenerateNetworkPageContentRequest(infoSystem.get());
|
||||
}
|
||||
|
||||
public SaveDBSettingsRequest saveDBSettingsRequest() {
|
||||
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.djrapitops.plan.system.info.InfoSystem;
|
|||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
|
@ -27,6 +28,7 @@ public class InfoRequestHandlerFactory {
|
|||
private final Lazy<PlanPlugin> plugin;
|
||||
private final Lazy<PlanConfig> config;
|
||||
private final Lazy<Processing> processing;
|
||||
private final Lazy<Processors> processors;
|
||||
private final Lazy<InfoSystem> infoSystem;
|
||||
private final Lazy<ConnectionSystem> connectionSystem;
|
||||
private final Lazy<ServerInfo> serverInfo;
|
||||
|
@ -42,6 +44,7 @@ public class InfoRequestHandlerFactory {
|
|||
Lazy<PlanPlugin> plugin,
|
||||
Lazy<PlanConfig> config,
|
||||
Lazy<Processing> processing,
|
||||
Lazy<Processors> processors,
|
||||
Lazy<InfoSystem> infoSystem,
|
||||
Lazy<ConnectionSystem> connectionSystem,
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
|
@ -55,6 +58,7 @@ public class InfoRequestHandlerFactory {
|
|||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
this.processors = processors;
|
||||
this.infoSystem = infoSystem;
|
||||
this.connectionSystem = connectionSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
|
@ -67,7 +71,7 @@ public class InfoRequestHandlerFactory {
|
|||
}
|
||||
|
||||
CacheRequest cacheAnalysisPageRequest() {
|
||||
return new CacheAnalysisPageRequest(config.get(), processing.get(), htmlExport.get());
|
||||
return new CacheAnalysisPageRequest(config.get(), processing.get(), processors.get(), htmlExport.get());
|
||||
}
|
||||
|
||||
CacheRequest cacheInspectPageRequest() {
|
||||
|
@ -98,10 +102,6 @@ public class InfoRequestHandlerFactory {
|
|||
return new GenerateInspectPluginsTabRequest(infoSystem.get(), infoRequestFactory.get(), pageFactory.get());
|
||||
}
|
||||
|
||||
GenerateRequest generateNetworkPageContentRequest() {
|
||||
return new GenerateNetworkPageContentRequest(infoSystem.get());
|
||||
}
|
||||
|
||||
SetupRequest saveDBSettingsRequest() {
|
||||
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ public class InfoRequests extends HashMap<String, InfoRequest> {
|
|||
putRequest(handlers.generateAnalysisPageRequest());
|
||||
putRequest(handlers.generateInspectPageRequest());
|
||||
putRequest(handlers.generateInspectPluginsTabRequest());
|
||||
putRequest(handlers.generateNetworkPageContentRequest());
|
||||
|
||||
putRequest(handlers.saveDBSettingsRequest());
|
||||
putRequest(handlers.sendDBSettingsRequest());
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.djrapitops.plan.system.processing.processors.info;
|
|||
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import dagger.Lazy;
|
||||
|
@ -19,16 +20,18 @@ import java.util.function.BiConsumer;
|
|||
@Singleton
|
||||
public class InfoProcessors {
|
||||
|
||||
private final Lazy<ServerInfo> serverInfo;
|
||||
private final Lazy<InfoSystem> infoSystem;
|
||||
private final Lazy<WebExceptionLogger> webExceptionLogger;
|
||||
private final Lazy<RunnableFactory> runnableFactory;
|
||||
|
||||
@Inject
|
||||
public InfoProcessors(
|
||||
Lazy<InfoSystem> infoSystem,
|
||||
Lazy<ServerInfo> serverInfo, Lazy<InfoSystem> infoSystem,
|
||||
Lazy<WebExceptionLogger> webExceptionLogger,
|
||||
Lazy<RunnableFactory> runnableFactory
|
||||
) {
|
||||
this.serverInfo = serverInfo;
|
||||
this.infoSystem = infoSystem;
|
||||
this.webExceptionLogger = webExceptionLogger;
|
||||
this.runnableFactory = runnableFactory;
|
||||
|
@ -46,7 +49,7 @@ public class InfoProcessors {
|
|||
}
|
||||
|
||||
public NetworkPageUpdateProcessor networkPageUpdateProcessor() {
|
||||
return new NetworkPageUpdateProcessor(infoSystem.get(), webExceptionLogger.get());
|
||||
return new NetworkPageUpdateProcessor(serverInfo.get());
|
||||
}
|
||||
|
||||
public PlayerPageUpdateProcessor playerPageUpdateProcessor(UUID uuid) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*/
|
||||
package com.djrapitops.plan.system.processing.processors.info;
|
||||
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
|
||||
/**
|
||||
* Processor for updating the network page.
|
||||
|
@ -14,19 +15,16 @@ import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
|||
*/
|
||||
public class NetworkPageUpdateProcessor implements Runnable {
|
||||
|
||||
private final InfoSystem infoSystem;
|
||||
private final WebExceptionLogger webExceptionLogger;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
NetworkPageUpdateProcessor(
|
||||
InfoSystem infoSystem,
|
||||
WebExceptionLogger webExceptionLogger
|
||||
ServerInfo serverInfo
|
||||
) {
|
||||
this.infoSystem = infoSystem;
|
||||
this.webExceptionLogger = webExceptionLogger;
|
||||
this.serverInfo = serverInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
webExceptionLogger.logIfOccurs(this.getClass(), infoSystem::updateNetworkPage);
|
||||
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
|||
runnableFactory,
|
||||
Check.isPaperAvailable() ? paperTPSCountTimer : bukkitTPSCountTimer,
|
||||
config,
|
||||
networkPageRefreshTask,
|
||||
bootAnalysisTask,
|
||||
periodicAnalysisTask,
|
||||
logsFolderCleanTask
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package com.djrapitops.plan.system.tasks;
|
||||
|
||||
import com.djrapitops.plan.system.tasks.bungee.BungeeTPSCountTimer;
|
||||
import com.djrapitops.plan.system.tasks.bungee.EnableConnectionTask;
|
||||
import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
@ -20,7 +19,6 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public class BungeeTaskSystem extends TaskSystem {
|
||||
|
||||
private final EnableConnectionTask enableConnectionTask;
|
||||
private final NetworkPageRefreshTask networkPageRefreshTask;
|
||||
private final LogsFolderCleanTask logsFolderCleanTask;
|
||||
|
||||
|
@ -28,13 +26,11 @@ public class BungeeTaskSystem extends TaskSystem {
|
|||
public BungeeTaskSystem(
|
||||
RunnableFactory runnableFactory,
|
||||
BungeeTPSCountTimer bungeeTPSCountTimer,
|
||||
EnableConnectionTask enableConnectionTask,
|
||||
NetworkPageRefreshTask networkPageRefreshTask,
|
||||
LogsFolderCleanTask logsFolderCleanTask
|
||||
) {
|
||||
super(runnableFactory, bungeeTPSCountTimer);
|
||||
|
||||
this.enableConnectionTask = enableConnectionTask;
|
||||
this.networkPageRefreshTask = networkPageRefreshTask;
|
||||
this.logsFolderCleanTask = logsFolderCleanTask;
|
||||
}
|
||||
|
@ -45,7 +41,6 @@ public class BungeeTaskSystem extends TaskSystem {
|
|||
}
|
||||
|
||||
private void registerTasks() {
|
||||
registerTask(enableConnectionTask).runTaskAsynchronously();
|
||||
registerTask(tpsCountTimer).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
||||
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(1500, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
|
||||
registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.djrapitops.plan.system.tasks;
|
|||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||
import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask;
|
||||
import com.djrapitops.plan.system.tasks.server.PeriodicAnalysisTask;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
@ -18,7 +17,6 @@ import java.util.concurrent.TimeUnit;
|
|||
public abstract class ServerTaskSystem extends TaskSystem {
|
||||
|
||||
private final PlanConfig config;
|
||||
private final NetworkPageRefreshTask networkPageRefreshTask;
|
||||
private final BootAnalysisTask bootAnalysisTask;
|
||||
private final PeriodicAnalysisTask periodicAnalysisTask;
|
||||
private final LogsFolderCleanTask logsFolderCleanTask;
|
||||
|
@ -27,13 +25,11 @@ public abstract class ServerTaskSystem extends TaskSystem {
|
|||
RunnableFactory runnableFactory,
|
||||
TPSCountTimer tpsCountTimer,
|
||||
PlanConfig config,
|
||||
NetworkPageRefreshTask networkPageRefreshTask,
|
||||
BootAnalysisTask bootAnalysisTask,
|
||||
PeriodicAnalysisTask periodicAnalysisTask,
|
||||
LogsFolderCleanTask logsFolderCleanTask) {
|
||||
super(runnableFactory, tpsCountTimer);
|
||||
this.config = config;
|
||||
this.networkPageRefreshTask = networkPageRefreshTask;
|
||||
this.bootAnalysisTask = bootAnalysisTask;
|
||||
this.periodicAnalysisTask = periodicAnalysisTask;
|
||||
this.logsFolderCleanTask = logsFolderCleanTask;
|
||||
|
@ -51,7 +47,6 @@ public abstract class ServerTaskSystem extends TaskSystem {
|
|||
long analysisPeriod = TimeAmount.toTicks(analysisRefreshMinutes, TimeUnit.MINUTES);
|
||||
|
||||
registerTask(tpsCountTimer).runTaskTimer(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
||||
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(20L, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
|
||||
registerTask(bootAnalysisTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
||||
|
||||
if (analysisRefreshTaskIsEnabled) {
|
||||
|
|
|
@ -31,7 +31,6 @@ public class SpongeTaskSystem extends ServerTaskSystem {
|
|||
runnableFactory,
|
||||
spongeTPSCountTimer,
|
||||
config,
|
||||
networkPageRefreshTask,
|
||||
bootAnalysisTask,
|
||||
periodicAnalysisTask,
|
||||
logsFolderCleanTask
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package com.djrapitops.plan.system.tasks.bungee;
|
||||
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class EnableConnectionTask extends AbsRunnable {
|
||||
|
||||
private ConnectionSystem connectionSystem;
|
||||
private final InfoRequestFactory infoRequestFactory;
|
||||
private final WebExceptionLogger webExceptionLogger;
|
||||
|
||||
@Inject
|
||||
public EnableConnectionTask(
|
||||
ConnectionSystem connectionSystem,
|
||||
InfoRequestFactory infoRequestFactory,
|
||||
WebExceptionLogger webExceptionLogger
|
||||
) {
|
||||
this.connectionSystem = connectionSystem;
|
||||
this.infoRequestFactory = infoRequestFactory;
|
||||
this.webExceptionLogger = webExceptionLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
webExceptionLogger.logIfOccurs(this.getClass(),
|
||||
() -> connectionSystem.sendWideInfoRequest(infoRequestFactory.generateNetworkPageContentRequest())
|
||||
);
|
||||
cancel();
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package com.djrapitops.plan.system.tasks.server;
|
||||
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -10,20 +11,15 @@ import javax.inject.Singleton;
|
|||
@Singleton
|
||||
public class NetworkPageRefreshTask extends AbsRunnable {
|
||||
|
||||
private InfoSystem infoSystem;
|
||||
private final WebExceptionLogger webExceptionLogger;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
@Inject
|
||||
public NetworkPageRefreshTask(
|
||||
InfoSystem infoSystem,
|
||||
WebExceptionLogger webExceptionLogger
|
||||
) {
|
||||
this.infoSystem = infoSystem;
|
||||
this.webExceptionLogger = webExceptionLogger;
|
||||
public NetworkPageRefreshTask(ServerInfo serverInfo) {
|
||||
this.serverInfo = serverInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
webExceptionLogger.logIfOccurs(this.getClass(), () -> infoSystem.updateNetworkPage());
|
||||
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,12 +70,7 @@ public class ServerPageHandler implements PageHandler {
|
|||
return response;
|
||||
} else {
|
||||
if (Check.isBungeeAvailable() && serverInfo.getServerUUID().equals(serverUUID)) {
|
||||
try {
|
||||
infoSystem.updateNetworkPage();
|
||||
} catch (WebException e) {
|
||||
/*Ignore, should not occur*/
|
||||
}
|
||||
return ResponseCache.loadResponse(PageId.SERVER.of(serverUUID));
|
||||
return ResponseCache.loadResponse(PageId.SERVER.of(serverUUID), responseFactory::networkPageResponse);
|
||||
}
|
||||
return refreshNow(serverUUID);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
import com.djrapitops.plan.system.webserver.response.pages.parts.NetworkPageContent;
|
||||
import com.djrapitops.plan.utilities.formatting.PlaceholderReplacer;
|
||||
|
||||
import static com.djrapitops.plan.data.store.keys.NetworkKeys.*;
|
||||
|
@ -54,11 +51,9 @@ public class NetworkPage implements Page {
|
|||
WORLD_MAP_SERIES, WORLD_MAP_HIGH_COLOR, WORLD_MAP_LOW_COLOR,
|
||||
COUNTRY_CATEGORIES, COUNTRY_SERIES,
|
||||
HEALTH_INDEX, HEALTH_NOTES,
|
||||
ACTIVITY_PIE_SERIES, ACTIVITY_STACK_SERIES, ACTIVITY_STACK_CATEGORIES
|
||||
ACTIVITY_PIE_SERIES, ACTIVITY_STACK_SERIES, ACTIVITY_STACK_CATEGORIES,
|
||||
SERVERS_TAB
|
||||
);
|
||||
NetworkPageContent networkPageContent = (NetworkPageContent)
|
||||
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
||||
placeholderReplacer.put("tabContentServers", networkPageContent.getContents());
|
||||
|
||||
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/network.html"));
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user