Fix: too many milo parallel tasks hurting server #46
Reference in New Issue
Block a user
Delete Branch "lemmmy/fix-milo-parallel"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We had a player on SwitchCraft recently with >500 chests in their Milo. Milo does a pretty good job of throttling things to avoid hurting the server in this case, however, it relies on a single
peripheral.waitForAllcall to wait for all the throttles to complete. This ended up spawning 480 coroutine threads for this particular user's Milo:By reaching the thread limit, these parallel calls actually never finished, causing the user to try to boot-loop their Milo until it would work, causing more damage. We also got alerts about it every 5 minutes on the staff Discord :P
In this patch, I've chunked the tasks in
Storage:listItems()to only run 16 at a time. This limit might need to be tuned, but in my testing it runs just as fast, and doesn't spawn infinite threads in the process.