This idea might not work. Extensive testing is needed before merging.
Right now, all chests/tanks in the network update from the same FIFO queue. This is fair and works reasonably well, but in a standard factory there are usually a handful of high-throughput chests and a large number of unused chests.
My guess is that the "handful of high-throughput chests" should have higher priority than the unused chests. This could be done by adding a new "Recently Used" FIFO queue just for entities that have been updated in the last 10? seconds. Since the mod updates 20 entities each tick, maybe min(recently_used_queue.size, 15) can come from the recently used queue and the remaining from the normal queue
In preparation for this, update_entity functions return UPDATE_STATUS.UPDATED if the update operation transferred any items.
A few things to keep track of:
- track number of "active" vs "inactive" chests and use to tune the active duration.
- add a case to handle high-throughput factories where every chest updates each tick
- figure out where to store
last_updated_tick for each entity.
- This should probably have a unit test or two.
This idea might not work. Extensive testing is needed before merging.
Right now, all chests/tanks in the network update from the same FIFO queue. This is fair and works reasonably well, but in a standard factory there are usually a handful of high-throughput chests and a large number of unused chests.
My guess is that the "handful of high-throughput chests" should have higher priority than the unused chests. This could be done by adding a new "Recently Used" FIFO queue just for entities that have been updated in the last 10? seconds. Since the mod updates 20 entities each tick, maybe
min(recently_used_queue.size, 15)can come from the recently used queue and the remaining from the normal queueIn preparation for this,
update_entityfunctions returnUPDATE_STATUS.UPDATEDif the update operation transferred any items.A few things to keep track of:
last_updated_tickfor each entity.