diff options
author | Nick Thomas <nick@gitlab.com> | 2018-08-28 11:03:39 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-08-28 11:03:39 +0000 |
commit | ad985d8d6be8274a8ea35808a94354a333cb8e8c (patch) | |
tree | 22f2b7ff9908a43c58b36137d82ae89171fbb993 /app/models/project.rb | |
parent | 270c7b6f78cb09c23f14be550ca054da6978002b (diff) | |
parent | 414c54cec2e6e3b9c6e4cf003b78a637464b6d8b (diff) | |
download | gitlab-ce-ad985d8d6be8274a8ea35808a94354a333cb8e8c.tar.gz |
Merge branch '50441-high-number-of-statement-timeouts-in-groupdestroyworker-due-to-sitestatistics' into 'master'
Resolve "High number of statement timeouts in GroupDestroyWorker due to SiteStatistics"
Closes #50441
See merge request gitlab-org/gitlab-ce!21366
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 178d70757a1..67593c9b2fe 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -85,8 +85,7 @@ class Project < ActiveRecord::Base after_create :create_project_feature, unless: :project_feature after_create -> { SiteStatistic.track(STATISTICS_ATTRIBUTE) } - before_destroy ->(project) { project.project_feature.untrack_statistics_for_deletion! } - after_destroy -> { SiteStatistic.untrack(STATISTICS_ATTRIBUTE) } + before_destroy :untrack_site_statistics after_create :create_ci_cd_settings, unless: :ci_cd_settings, @@ -2099,6 +2098,11 @@ class Project < ActiveRecord::Base Gitlab::PagesTransfer.new.rename_project(path_before, self.path, namespace.full_path) end + def untrack_site_statistics + SiteStatistic.untrack(STATISTICS_ATTRIBUTE) + self.project_feature.untrack_statistics_for_deletion! + end + def execute_rename_repository_hooks!(full_path_before) # When we import a project overwriting the original project, there # is a move operation. In that case we don't want to send the instructions. |