storage/sqlite/sqlite-storage.go | 6 +++--- diff --git a/storage/sqlite/sqlite-storage.go b/storage/sqlite/sqlite-storage.go index 22b4b8fd071f91e573ca06938da45a4bcfddc2ed..b046d0d3fddd814424a8cb7df82aef8e1b99d3c5 100644 --- a/storage/sqlite/sqlite-storage.go +++ b/storage/sqlite/sqlite-storage.go @@ -92,16 +92,16 @@ rowid, length(cast(data as blob)) from blob order by last_used, rowid limit 1 ) - where usage_with >= (select value from setting where name='capacity') + where usage_with > (select value from setting where name='capacity') union all select - usage_with-data_length, + usage_with-data_length as new_usage_with, blob.last_used, blob.rowid, length(cast(data as blob)) from excess join blob on blob.rowid=(select rowid from blob where (last_used, rowid) > (excess.last_used, blob_rowid)) - where usage_with >= (select value from setting where name='capacity') + where new_usage_with > (select value from setting where name='capacity') ) select * from excess;