milo: cleanup

This commit is contained in:
kepler155c@gmail.com
2019-01-04 04:13:00 -05:00
parent 1f00136f42
commit 57aecae996
4 changed files with 17 additions and 29 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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