File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
engine/src/main/java/org/terasology/engine/world/chunks/localChunkProvider Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ public class LocalChunkProvider implements ChunkProvider {
8282
8383 private static final Logger logger = LoggerFactory .getLogger (LocalChunkProvider .class );
8484 private static final int UNLOAD_PER_FRAME = 64 ;
85+ private static final int UPDATE_PROCESSING_DEADLINE_MS = 24 ;
8586 private final EntityManager entityManager ;
8687 private final BlockingQueue <Chunk > readyChunks = Queues .newLinkedBlockingQueue ();
8788 private final BlockingQueue <TShortObjectMap <TIntList >> deactivateBlocksQueue = Queues .newLinkedBlockingQueue ();
@@ -229,8 +230,16 @@ public void update() {
229230 deactivateBlocks ();
230231 checkForUnload ();
231232 Chunk chunk ;
233+
234+ long processingStartTime = System .currentTimeMillis ();
232235 while ((chunk = readyChunks .poll ()) != null ) {
233236 processReadyChunk (chunk );
237+ long totalProcessingTime = System .currentTimeMillis () - processingStartTime ;
238+ if (!readyChunks .isEmpty () && totalProcessingTime > UPDATE_PROCESSING_DEADLINE_MS ) {
239+ logger .warn ("Chunk processing took too long this tick ({}/{}ms). {} chunks remain." , totalProcessingTime ,
240+ UPDATE_PROCESSING_DEADLINE_MS , readyChunks .size ());
241+ break ;
242+ }
234243 }
235244 }
236245
You can’t perform that action at this time.
0 commit comments