Merge branch 'mc/1.13'

This commit is contained in:
Blue (Lukas Rieger) 2020-04-09 17:28:03 +02:00
commit ee4d84ee0a
2 changed files with 20 additions and 14 deletions

View File

@ -141,11 +141,10 @@ private void renderThread() {
try { try {
ticket.render(); ticket.render();
} catch (IOException e) { } catch (IOException e) {
if (ticket.getRenderAttempts() < 3) { if (ticket.getRenderAttempts() <= 1) {
Logger.global.logDebug("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "', rescheduling for " + (ticket.getRenderAttempts() + 1) + ". attempt.."); createTicket(ticket);
createTicket(ticket); //this might be a temporary issue, so we reschedule ticket for another attempt
} else { } else {
Logger.global.logError("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "'!", e); Logger.global.logDebug("Failed to render tile " + ticket.getTile() + " of map '" + ticket.getMapType().getId() + "' after " + ticket.getRenderAttempts() + " render-attempts! (" + e.toString() + ")");
} }
} }
} else { } else {

View File

@ -21,20 +21,27 @@ public MapUpdateHandler() {
} }
@Override @Override
public void onWorldSaveToDisk(UUID world) { public void onWorldSaveToDisk(final UUID world) {
RenderManager renderManager = Plugin.getInstance().getRenderManager(); RenderManager renderManager = Plugin.getInstance().getRenderManager();
synchronized (updateBuffer) { new Thread(() -> {
Iterator<MapType> iterator = updateBuffer.keys().iterator(); try {
while (iterator.hasNext()) { Thread.sleep(5000); // wait 5 sec before rendering so saving has finished to avoid render-errors
MapType map = iterator.next();
if (map.getWorld().getUUID().equals(world)) {
renderManager.createTickets(map, updateBuffer.get(map));
iterator.remove();
}
}
} synchronized (updateBuffer) {
Iterator<MapType> iterator = updateBuffer.keys().iterator();
while (iterator.hasNext()) {
MapType map = iterator.next();
if (map.getWorld().getUUID().equals(world)) {
renderManager.createTickets(map, updateBuffer.get(map));
iterator.remove();
}
}
}
} catch (InterruptedException ignore) {}
}).start();
} }
@Override @Override