Commit 1393f8dd authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix-34019' into 'master'

Perform project housekeeping after importing projects

Closes #34019

See merge request !12323
parents ae5a0207 429c3ccc
......@@ -350,7 +350,10 @@ class Project < ActiveRecord::Base
project.run_after_commit { add_import_job }
end
after_transition started: :finished, do: :reset_cache_and_import_attrs
after_transition started: :finished do |project, _|
project.reset_cache_and_import_attrs
project.perform_housekeeping
end
end
class << self
......@@ -510,6 +513,18 @@ class Project < ActiveRecord::Base
remove_import_data
end
def perform_housekeeping
return unless repo_exists?
run_after_commit do
begin
Projects::HousekeepingService.new(self).execute
rescue Projects::HousekeepingService::LeaseTaken => e
Rails.logger.info("Could not perform housekeeping for project #{self.path_with_namespace} (#{self.id}): #{e}")
end
end
end
def remove_import_data
import_data&.destroy
end
......
---
title: Perform project housekeeping after importing projects
merge_request:
author:
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