mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-26 22:49:51 +02:00
Reduce memory usage with changes to player page refreshing
Old way: Pre-render & cache the html for a player page when the player joins, leaves or switches server New way: Render & cache the html when requested. Remove the rendered html from cache if the player joins, leaves or switches server This should prevent server from crashing if a bunch of bots join Impacts #685
This commit is contained in:
parent
7954796582
commit
3781115311
|
@ -1,11 +1,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.plugin.api.Check;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -19,20 +15,6 @@ public class PlayerPageUpdateProcessor implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!InfoSystem.getInstance().getConnectionSystem().isServerAvailable() || Check.isBungeeAvailable()) {
|
||||
RunnableFactory.createNew("Generate Inspect page: " + uuid, new AbsRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
WebExceptionLogger.logIfOccurs(PlayerPageUpdateProcessor.class,
|
||||
() -> InfoSystem.getInstance().generateAndCachePlayerPage(uuid)
|
||||
);
|
||||
} finally {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 5);
|
||||
}
|
||||
ResponseCache.clearResponse(PageId.PLAYER.of(uuid));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user