Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-06-29 12:22:52 +0300
committerMike Greiling <mike@pixelcog.com>2017-06-29 20:44:20 +0300
commitbdb889baed76a94bdfbe7148d22d8b6fbfb638a0 (patch)
tree7f8eb9b926259ba75eda78a1cc906d0aa36d8cb3 /app
parent8275f403a849e05b32fdb3affa2d57748b4988ed (diff)
Merge branch 'fix-34417' into 'master'
Perform housekeeping only when an import of a fresh project is completed Closes #34417 See merge request !12529
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb27
1 files changed, 10 insertions, 17 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4b289d15ae7..cf6515b9fa3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -352,7 +352,16 @@ class Project < ActiveRecord::Base
after_transition started: :finished do |project, _|
project.reset_cache_and_import_attrs
- project.perform_housekeeping
+
+ if Gitlab::ImportSources.importer_names.include?(project.import_type) && project.repo_exists?
+ project.run_after_commit do
+ begin
+ Projects::HousekeepingService.new(project).execute
+ rescue Projects::HousekeepingService::LeaseTaken => e
+ Rails.logger.info("Could not perform housekeeping for project #{project.path_with_namespace} (#{project.id}): #{e}")
+ end
+ end
+ end
end
end
@@ -510,22 +519,6 @@ class Project < ActiveRecord::Base
ProjectCacheWorker.perform_async(self.id)
end
- 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