Billable Member destroy service refactor
What does this MR do and why?
Refactors how the BillableMember::DestroyService
queries for Member
records to remove.
Previously we used the in_hierarchy
scope, which is known to be a performance bottleneck, to fetch all matching Members
and destroy each one appropriately.
This approach instead uses batches via each_batch
to find the records in batches and proceed to destroy them as before.
This new approach will hopefully resolve DB query timeout issues that sometimes occur when namespace hierarchies are both deep and wide (e.g. 1000s of projects for the given user), although it's still not an ideal solution as the overall request time might still be large.
Refs #467281
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.