Skip to content

Commit

Permalink
Schedule initial map-updates asynchronously to the loading process in…
Browse files Browse the repository at this point in the history
… case they take longer to construct
  • Loading branch information
TBlueF committed Jan 25, 2025
1 parent 0ed3fcb commit 9d14653
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,6 @@ private void load(@Nullable ResourcePack preloadedResourcePack) throws IOExcepti
//initialize render manager
renderManager = new RenderManager();

//update all maps
maps.values().stream()
.sorted(Comparator.comparing(bmMap -> bmMap.getMapSettings().getSorting()))
.forEach(map -> {
if (pluginState.getMapState(map).isUpdateEnabled()) {
renderManager.scheduleRenderTask(new MapUpdateTask(map));
}
});

//update webapp and settings
if (webappConfig.isEnabled())
blueMap.createOrUpdateWebApp(false);
Expand Down Expand Up @@ -336,14 +327,16 @@ public void run() {
TimerTask updateAllMapsTask = new TimerTask() {
@Override
public void run() {
for (BmMap map : maps.values()) {
if (pluginState.getMapState(map).isUpdateEnabled()) {
renderManager.scheduleRenderTask(new MapUpdateTask(map));
}
}
maps.values().stream()
.sorted(Comparator.comparing(bmMap -> bmMap.getMapSettings().getSorting()))
.forEach(map -> {
if (pluginState.getMapState(map).isUpdateEnabled()) {
renderManager.scheduleRenderTask(new MapUpdateTask(map));
}
});
}
};
daemonTimer.scheduleAtFixedRate(updateAllMapsTask, fullUpdateTime, fullUpdateTime);
daemonTimer.scheduleAtFixedRate(updateAllMapsTask, 0, fullUpdateTime);
}

//metrics
Expand Down

0 comments on commit 9d14653

Please sign in to comment.