Reduce queries to user_custom_attributes table
What does this MR do and why?
Related to https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/503
Context
When User#active_for_authentication? -> User#signup_identity_verified?
is executed user_custom_attributes
table is queries 5 times.
This contributes to db_duration_s
of sign-up (POST RegistrationsController#create
) requests which is affecting our SLOs as shown in https://log.gprd.gitlab.net/app/r/s/RfycH:
Change
This MR updates how relevant UserCustomAttribute
records are fetched when identity_verification_exempt?
, exempt_from_phone_number_verification?
, assumed_high_risk?
, high_risk?
, and medium_risk?
methods are called as part of execution of User#active_for_authentication? -> User#signup_identity_verified?
.
With this change, user_custom_attributes
is only queried once.
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.