-
- Downloads
Fix project destruction failing due to idle in transaction timeouts
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
Showing
- app/models/concerns/batch_destroy_dependent_associations.rb 28 additions, 0 deletionsapp/models/concerns/batch_destroy_dependent_associations.rb
- app/models/project.rb 1 addition, 0 deletionsapp/models/project.rb
- app/services/projects/destroy_service.rb 7 additions, 1 deletionapp/services/projects/destroy_service.rb
- changelogs/unreleased/sh-batch-dependent-destroys.yml 5 additions, 0 deletionschangelogs/unreleased/sh-batch-dependent-destroys.yml
- spec/models/concerns/batch_destroy_dependent_associations_spec.rb 60 additions, 0 deletions...els/concerns/batch_destroy_dependent_associations_spec.rb
Please register or sign in to comment