milo performance update
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
local itemDB = require('core.itemDB')
|
local itemDB = require('core.itemDB')
|
||||||
local Milo = require('milo')
|
local Milo = require('milo')
|
||||||
|
|
||||||
|
local parallel = _G.parallel
|
||||||
|
|
||||||
local ImportTask = {
|
local ImportTask = {
|
||||||
name = 'importer',
|
name = 'importer',
|
||||||
priority = 20,
|
priority = 20,
|
||||||
@@ -11,7 +13,10 @@ local function filter(a)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ImportTask:cycle(context)
|
function ImportTask:cycle(context)
|
||||||
|
local tasks = { }
|
||||||
|
|
||||||
for node in context.storage:filterActive('machine', filter) do
|
for node in context.storage:filterActive('machine', filter) do
|
||||||
|
table.insert(tasks, function()
|
||||||
local s, m = pcall(function()
|
local s, m = pcall(function()
|
||||||
for _, entry in pairs(node.imports) do
|
for _, entry in pairs(node.imports) do
|
||||||
|
|
||||||
@@ -65,9 +70,16 @@ function ImportTask:cycle(context)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
if #tasks > 0 then
|
||||||
|
parallel.waitForAll(table.unpack(tasks))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -446,7 +446,9 @@ Unlocked Slots : %d of %d (%d%%)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Event.onTimeout(0, function()
|
||||||
UI:setPage(page)
|
UI:setPage(page)
|
||||||
|
end)
|
||||||
return page
|
return page
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
local Event = require('event')
|
||||||
local Milo = require('milo')
|
local Milo = require('milo')
|
||||||
local UI = require('ui')
|
local UI = require('ui')
|
||||||
|
|
||||||
@@ -76,10 +77,14 @@ end
|
|||||||
|
|
||||||
function task:cycle(context)
|
function task:cycle(context)
|
||||||
for node in context.storage:filterActive('trashcan', filter) do
|
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
|
for k in pairs(node.adapter.list()) do
|
||||||
local direction = node.dropDirection or 'down'
|
local direction = node.dropDirection or 'down'
|
||||||
node.adapter.drop(k, 64, direction)
|
node.adapter.drop(k, 64, direction)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user