Add a Defragment button to Milo #36

Merged
Luca0208 merged 10 commits from develop-1.8-milo-defrag into develop-1.8 2020-05-10 01:48:40 -04:00
Showing only changes of commit 2f187a196f - Show all commits

View File

@@ -336,6 +336,7 @@ end
-- defrags the storage system
function Storage:defrag(throttle)
local items = self:listProviders(throttle)
local slotsSaved = 0
for _, providers in pairs(items) do
table.sort(providers, function(a, b)
@@ -368,6 +369,7 @@ function Storage:defrag(throttle)
if from.item.count <= 0 then
table.remove(providers, 1)
slotsSaved = slotsSaved + 1
end
table.sort(providers, function(a, b)
@@ -375,6 +377,8 @@ function Storage:defrag(throttle)
end)
end
end
return slotsSaved
end
function Storage:updateCache(adapter, item, count)