Commit 9afbf5d1 authored by Valery Sizov's avatar Valery Sizov

Rake gitlab:cleanup:orphan_lfs_files clears the cache with project

It used to just clear LFS files but the project size should
 be recalculated. So we spawn the worker that will clear the cache
parent e5ee54cb
---
title: Rake task gitlab:cleanup:orphan_lfs_files should clear the cached value or repository size
merge_request: 32541
author:
type: fixed
......@@ -34,6 +34,7 @@ describe Gitlab::Cleanup::OrphanLfsFileReferences do
it 'prints messages and deletes invalid reference' do
expect(null_logger).to receive(:info).with("Looking for orphan LFS files for project #{project.name_with_namespace}")
expect(null_logger).to receive(:info).with("Removed invalid references: 1")
expect(ProjectCacheWorker).to receive(:perform_async).with(project.id, [], [:lfs_objects_size])
expect { described_class.new(project, logger: null_logger, dry_run: false).run! }
.to change { project.lfs_objects.count }.from(2).to(1)
......
......@@ -35,6 +35,8 @@ module Gitlab
count += relation.delete_all
end
ProjectCacheWorker.perform_async(project.id, [], [:lfs_objects_size])
log_info("Removed invalid references: #{count}")
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment