Compare commits
2 Commits
d743f8f2b2
...
8d1c2854f6
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 8d1c2854f6 | |
Shadowfacts | bae2a32cb0 |
|
@ -161,11 +161,12 @@ class TerminalBlockEntity: DeviceBlockEntity(PhyBlockEntities.TERMINAL),
|
||||||
|
|
||||||
private fun finishPendingRequests() {
|
private fun finishPendingRequests() {
|
||||||
if (world!!.isClient) return
|
if (world!!.isClient) return
|
||||||
if (pendingRequests.isEmpty()) return
|
|
||||||
|
|
||||||
val finishable = pendingRequests.filter { it.isFinishable(counter) }
|
for (request in pendingRequests) {
|
||||||
finishable.forEach(::stackLocateRequestCompleted)
|
if (request.isFinishable(counter)) {
|
||||||
pendingRequests.removeAll(finishable)
|
stackLocateRequestCompleted(request)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addObserver() {
|
fun addObserver() {
|
||||||
|
|
|
@ -72,10 +72,9 @@ interface NetworkStackDispatcher<Insertion: NetworkStackDispatcher.PendingInsert
|
||||||
|
|
||||||
fun <Self, Insertion: NetworkStackDispatcher.PendingInsertion<Insertion>> Self.finishTimedOutPendingInsertions() where Self: BlockEntity, Self: NetworkStackDispatcher<Insertion> {
|
fun <Self, Insertion: NetworkStackDispatcher.PendingInsertion<Insertion>> Self.finishTimedOutPendingInsertions() where Self: BlockEntity, Self: NetworkStackDispatcher<Insertion> {
|
||||||
if (world!!.isClient) return
|
if (world!!.isClient) return
|
||||||
if (pendingInsertions.isEmpty()) return
|
|
||||||
|
|
||||||
val finishable = pendingInsertions.filter { it.isFinishable(this) }
|
pendingInsertions
|
||||||
finishable.forEach(::finishInsertion)
|
.filter { it.isFinishable(this) }
|
||||||
pendingInsertions.removeAll(finishable)
|
.forEach(::finishInsertion)
|
||||||
// todo: if a timed-out insertion can't be finished, we should probably retry after some time (exponential backoff?)
|
// todo: if a timed-out insertion can't be finished, we should probably retry after some time (exponential backoff?)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue