Improve render load error handling

This commit is contained in:
James Seibel
2026-02-08 21:06:01 -06:00
parent 78f83197d7
commit 9f22e3f2b3
@@ -164,10 +164,7 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
return false;
}
try
{
CompletableFuture<Void> future = new CompletableFuture<>();
this.getAndBuildRenderDataFuture = future;
future.handle((voidObj, throwable) ->
{
// the task is done, we don't need to track these anymore
@@ -177,7 +174,12 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
return null;
});
try
{
this.getAndBuildRenderDataFuture = future;
this.getAndBuildRenderDataRunnable = () ->
{
try
{
this.refreshActiveBeaconList();
@@ -194,6 +196,12 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
// the future is passed in separately (IE not using the local var) to prevent any possible race condition null pointers
future.complete(null);
});
}
catch (Exception e)
{
LOGGER.error("Unexpected issue creating render data for pos: ["+DhSectionPos.toString(this.pos)+"], error: ["+e.getMessage()+"].", e);
future.complete(null);
}
};
executor.execute(this.getAndBuildRenderDataRunnable);
@@ -201,7 +209,7 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
}
catch (RejectedExecutionException ignore)
{
this.getAndBuildRenderDataFuture.complete(null);
future.complete(null);
/* the thread pool was probably shut down because it's size is being changed, just wait a sec and it should be back */
return false;