Fix ConcurrentModificationException when attempting to finish timed out insertions

This commit is contained in:
Shadowfacts 2021-02-17 22:31:48 -05:00
parent 6a06ef6ae0
commit bae2a32cb0
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 4 additions and 4 deletions

View File

@ -73,8 +73,8 @@ interface NetworkStackDispatcher<Insertion: NetworkStackDispatcher.PendingInsert
fun <Self, Insertion: NetworkStackDispatcher.PendingInsertion<Insertion>> Self.finishTimedOutPendingInsertions() where Self: BlockEntity, Self: NetworkStackDispatcher<Insertion> {
if (world!!.isClient) return
for (insertion in pendingInsertions) {
if (!insertion.isFinishable(this)) continue
finishInsertion(insertion)
}
pendingInsertions
.filter { it.isFinishable(this) }
.forEach(::finishInsertion)
// todo: if a timed-out insertion can't be finished, we should probably retry after some time (exponential backoff?)
}