Update FindRecordsDueForRefreshService to use SQL queries
What does this MR do and why?
Update FindRecordsDueForRefreshService to use SQL queries
- Currently
FindRecordsDueForRefreshService
gets all the user'sproject_authorizations
and loops through them to removeproject_authorizations
that are duplicate. Instead of doing this calculation in rails, this MR usesgroup by
andhaving(count)
to do them in SQL instead. - Currently, the
AuthorizedProjectsWorker
(which callsFindRecordsDueForRefreshService
) is exceeding it's SLA. Once of the things we have noticed from the logs is the total duration for a job is double the database duration. So this MR attempts to reduce the total duration. - No change in functionality or result
- Changelog isn't needed since change is behind FF
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.
Related to #484754 (closed)
Edited by Hinam Mehra