diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-01 11:06:44 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-01 11:06:44 +0300 |
commit | 1d53918b62452f9758a837744bac6ca051801a6a (patch) | |
tree | 0ec25b71a106a3d5c1f9e7771f3b0eae909630f0 /app/models/project.rb | |
parent | b9cc1188a98f6fef103f0b6553bc6783bcf95fc1 (diff) |
Introduces `FastDestroyAll` module
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 48e30f0fd36..fd46c7b1c70 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -78,6 +78,12 @@ class Project < ActiveRecord::Base after_update :update_forks_visibility_level before_destroy :remove_private_deploy_keys + + # This has to be defined before `has_many :builds, depenedent: :destroy`, + # otherwise we will not delete any data, due to trace chunks + # going through :builds + before_destroy -> { run_after_commit(&build_trace_chunks.delete_all_external_data_proc) } + after_destroy -> { run_after_commit { remove_pages } } after_destroy :remove_exports @@ -214,14 +220,6 @@ class Project < ActiveRecord::Base has_many :commit_statuses has_many :pipelines, class_name: 'Ci::Pipeline', inverse_of: :project - # This has to be defined before `has_many :builds, depenedent: :destroy`, - # otherwise we will not delete any data, due to trace chunks - # going through :builds - before_destroy do - puts "destroying all chunks" - self.run_after_commit(&build_trace_chunks.delayed_cleanup_blk) - end - # Ci::Build objects store data on the file system such as artifact files and # build traces. Currently there's no efficient way of removing this data in # bulk that doesn't involve loading the rows into memory. As a result we're |