Files
opus-apps/milo/plugins/refreshTask.lua
kepler155c@gmail.com eee431ce26 oops
2019-02-13 20:49:58 -05:00

24 lines
534 B
Lua

local Milo = require('milo')
local RefreshTask = {
name = 'refresher',
priority = 0,
}
function RefreshTask:cycle(context)
local now = os.clock()
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: ' .. (node.displayName or node.name))
context.storage.dirty = true
adapter.dirty = true
adapter.lastRefresh = now
end
end
end
end
Milo:registerTask(RefreshTask)