milo: cleanup
This commit is contained in:
@@ -80,8 +80,7 @@ function ExportTask:cycle(context)
|
||||
end
|
||||
end)
|
||||
if not s and m then
|
||||
_G._debug('Importer error')
|
||||
_G._debug(m)
|
||||
_G._debug('EXPORTER error: ' .. m)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local Milo = require('milo')
|
||||
local itemDB = require('itemDB')
|
||||
local Milo = require('milo')
|
||||
|
||||
local ImportTask = {
|
||||
name = 'importer',
|
||||
@@ -42,25 +43,30 @@ function ImportTask:cycle(context)
|
||||
return itemMatchesFilter(item)
|
||||
end
|
||||
|
||||
local list = node.adapter.list()
|
||||
|
||||
local function importSlot(slotNo)
|
||||
local item = node.adapter.getItemMeta(slotNo)
|
||||
local item = itemDB:get(list[slotNo], function()
|
||||
return node.adapter.getItemMeta(slotNo)
|
||||
end)
|
||||
if item and matchesFilter(item) then
|
||||
context.storage:import(node, slotNo, item.count, item)
|
||||
end
|
||||
end
|
||||
|
||||
if type(entry.slot) == 'number' then
|
||||
importSlot(entry.slot)
|
||||
if list[entry.slot] then
|
||||
importSlot(entry.slot)
|
||||
end
|
||||
else
|
||||
for i in pairs(node.adapter.list()) do
|
||||
for i in pairs(list) do
|
||||
importSlot(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
if not s and m then
|
||||
_G._debug('Importer error')
|
||||
_G._debug(m)
|
||||
_G._debug('IMPORTER error: ' .. m)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,10 +8,10 @@ local RefreshTask = {
|
||||
function RefreshTask:cycle(context)
|
||||
local now = os.clock()
|
||||
|
||||
for node, adapter in context.storage:onlineAdapters() do
|
||||
for node, adapter in context.storage:onlineAdapters() do
|
||||
if node.refreshInterval then
|
||||
if not adapter.lastRefresh or adapter.lastRefresh + node.refreshInterval < now then
|
||||
_G._debug('REFRESHER: ' .. adapter.name)
|
||||
_G._debug('REFRESHER: ' .. node.displayName or node.name)
|
||||
context.storage.dirty = true
|
||||
adapter.dirty = true
|
||||
adapter.lastRefresh = now
|
||||
|
||||
Reference in New Issue
Block a user