Skip to content

Remove memoization in TrialsHelper#trial_eligible_namespaces

What does this MR do and why?

Removes memorization in TrialsHelper#trial_eligible_namespaces as it does not need to memorized as the exact query only gets called once in the request/response cycle.

The method is only used in ee/app/views/subscriptions/trials/_select_namespace_form.html.haml, and gets called three times, first and second time through #any_trial_eligible_namespaces where current_user.manageable_namespaces_eligible_for_trial.any? query is called and cached. Third time through namespace_options_for_listbox where the actual current_user.manageable_namespaces_eligible_for_trial query is called.

Query executions in chronological order from performance bar:

without_memo

How to set up and validate locally

  1. Simulate SaaS, restart GDK and enable performance bar
  2. Sign in and make sure user has either no group eligible for trial or two and more groups eligible for trial.
  3. Visit /-/trials/new
  4. Fill in company form and submit
  5. After successful redirect, you should be able to see the query executions from performance bar

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #413704 (closed)

Edited by Roy Liu

Merge request reports