diff --git a/compacting-storage.lua b/compacting-storage.lua index 1b5d36d..7943108 100644 --- a/compacting-storage.lua +++ b/compacting-storage.lua @@ -129,8 +129,14 @@ function should_fill (type, counts) amount_needed = diff end else - fill_src = form - amount_spare = counts[form] + -- if the source is higher priority and using it would put it under + -- the fill limit, don't use it as a source + if fill_dest == nil and diff > -AMOUNT_USED then + -- do nothing + else + fill_src = form + amount_spare = counts[form] + end end if fill_src ~= nil and fill_dest ~= nil then break end end