milo: refresh interval
This commit is contained in:
@@ -8,9 +8,22 @@ local RefreshTask = {
|
||||
}
|
||||
|
||||
function RefreshTask:cycle(context)
|
||||
if os.clock() - context.storage.lastRefresh > 60 then
|
||||
context.storage:refresh()
|
||||
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: ' .. adapter.name)
|
||||
context.storage.dirty = true
|
||||
adapter.dirty = true
|
||||
adapter.lastRefresh = now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- if os.clock() - context.storage.lastRefresh > 60 then
|
||||
-- context.storage:refresh()
|
||||
-- end
|
||||
end
|
||||
|
||||
Milo:registerTask(RefreshTask)
|
||||
|
||||
Reference in New Issue
Block a user