milo performance update

This commit is contained in:
kepler155c@gmail.com
2019-03-06 12:32:11 -05:00
parent 76367eb8c9
commit 5a55c584b6
3 changed files with 71 additions and 52 deletions

View File

@@ -1,6 +1,8 @@
local itemDB = require('core.itemDB')
local Milo = require('milo')
local parallel = _G.parallel
local ImportTask = {
name = 'importer',
priority = 20,
@@ -11,7 +13,10 @@ local function filter(a)
end
function ImportTask:cycle(context)
local tasks = { }
for node in context.storage:filterActive('machine', filter) do
table.insert(tasks, function()
local s, m = pcall(function()
for _, entry in pairs(node.imports) do
@@ -65,9 +70,16 @@ function ImportTask:cycle(context)
end
end
end)
if not s and m then
_G._debug('IMPORTER error: ' .. m)
end
end)
end
if #tasks > 0 then
parallel.waitForAll(table.unpack(tasks))
end
end

View File

@@ -446,7 +446,9 @@ Unlocked Slots : %d of %d (%d%%)
end
end)
Event.onTimeout(0, function()
UI:setPage(page)
end)
return page
end

View File

@@ -1,3 +1,4 @@
local Event = require('event')
local Milo = require('milo')
local UI = require('ui')
@@ -76,10 +77,14 @@ end
function task:cycle(context)
for node in context.storage:filterActive('trashcan', filter) do
Event.onTimeout(0, function() -- run on a background thread
pcall(function()
for k in pairs(node.adapter.list()) do
local direction = node.dropDirection or 'down'
node.adapter.drop(k, 64, direction)
end
end)
end)
end
end