Fix LFK error routing logic
What does this MR do and why?
This an MR to fix my original implementation to override the feature category in the batch_cleaner_service. Wrapping the portion of the code that handled the deletion of the children records in an ApplicationContext.with_context block with the child table feature category did not work as intended. The errors were still being routed to database. When the run_cleaner_service raises an error inside the ApplicationContext.with_context block, it doesn't persist through the exception because the context is cleared once we exit the block. I reverted back to the original implementation and added a rescue block where I call Gitlab::ErrorTracking.track_exception and pass in the correct feature category.
References
- Loose Foreign key worker should override feature category from table
- Override LFK cleanup worker feature category for error routing
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.