FIX: cache_file storage cleanup logic was wrong

https://meta.discourse.org/t/68296
This commit is contained in:
Régis Hanol 2018-01-18 17:00:04 +01:00
parent 2a22b90538
commit 5f4f617689

View File

@ -131,7 +131,7 @@ module FileStore
FileUtils.mkdir_p(dir) unless Dir[dir].present?
FileUtils.cp(file.path, path)
# keep latest 500 files
`ls -tr #{CACHE_DIR} | head -n +#{CACHE_MAXIMUM_SIZE} | xargs rm -f`
`ls -tr #{CACHE_DIR} | head -n -#{CACHE_MAXIMUM_SIZE} | xargs rm -f`
end
private