milo performance update
This commit is contained in:
@@ -74,7 +74,6 @@ function ImportTask:cycle(context)
|
|||||||
if not s and m then
|
if not s and m then
|
||||||
_G._debug('IMPORTER error: ' .. m)
|
_G._debug('IMPORTER error: ' .. m)
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,35 @@
|
|||||||
local Milo = require('milo')
|
local Milo = require('milo')
|
||||||
|
|
||||||
|
local parallel = _G.parallel
|
||||||
|
|
||||||
local InputChest = {
|
local InputChest = {
|
||||||
name = 'input',
|
name = 'input',
|
||||||
priority = 10,
|
priority = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
function InputChest:cycle(context)
|
function InputChest:cycle(context)
|
||||||
|
local tasks = { }
|
||||||
for node in context.storage:filterActive('input') do
|
for node in context.storage:filterActive('input') do
|
||||||
for slot, item in pairs(node.adapter.list()) do
|
table.insert(tasks, function()
|
||||||
local s, m = pcall(function()
|
local s, m = pcall(function()
|
||||||
context.storage:import(node, slot, item.count, item)
|
for slot, item in pairs(node.adapter.list()) do
|
||||||
|
local s, m = pcall(function()
|
||||||
|
context.storage:import(node, slot, item.count, item)
|
||||||
|
end)
|
||||||
|
if not s and m then
|
||||||
|
_G._debug('INPUT error: ' .. m)
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not s and m then
|
if not s and m then
|
||||||
_G._debug('INPUT error: ' .. m)
|
_G._debug('INPUT error: ' .. m)
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
if #tasks > 0 then
|
||||||
|
parallel.waitForAll(table.unpack(tasks))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user