diff options
author | Stan Hu <stanhu@gmail.com> | 2018-04-26 19:45:22 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-05-24 16:40:02 -0700 |
commit | 760fdd1dd31d30d5ab407a0c42e864040d79504c (patch) | |
tree | db19fdc919e7492d2cd57b83b53d91a3da6f4b7a /app/models/project.rb | |
parent | ba58a66a55e2270eb46f7429e070d16f77d25b9d (diff) | |
download | gitlab-ce-760fdd1dd31d30d5ab407a0c42e864040d79504c.tar.gz |
Fix project destruction failing due to idle in transaction timeoutssh-batch-dependent-destroys
When deleting associated records, Rails loads all associations into memory
(https://github.com/rails/rails/issues/22510) before destroying them. This
can cause a surge in memory and cause destruction of objects to fail
due to idle in transaction database timeouts. This fix is inspired from
https://github.com/thisismydesign to destroy `has_many` relationships
in batches.
Closes #44610
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 0fe9f8880b4..e275ac4dc6f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -24,6 +24,7 @@ class Project < ActiveRecord::Base include ChronicDurationAttribute include FastDestroyAll::Helpers include WithUploads + include BatchDestroyDependentAssociations extend Gitlab::ConfigHelper |