Add throttling to defragger

This commit is contained in:
Anavrins
2020-04-18 19:06:50 -04:00
parent ca0cb0dabb
commit cedb807e89
2 changed files with 25 additions and 13 deletions

View File

@@ -256,7 +256,8 @@ function page:eventHandler(event)
self:setFocus(self.statusBar.filter)
elseif event.type == 'defrag' then
context.storage:defrag()
self:defrag()
self:refresh(true)
elseif event.type == 'toggle_display' then
displayMode = (displayMode + 1) % 2
@@ -365,6 +366,14 @@ function page:refresh(force)
self.throttle:disable()
end
function page:defrag()
local throttle = function() self.throttle:update() end
self.throttle:enable()
context.storage:defrag(throttle)
self.throttle:disable()
end
function page:applyFilter()
local function filterItems(t, filter)
self.grid.sortColumn = Milo:getState('sortColumn') or 'count'