Skip to content

Make MultiStoreConnectionPool resilient to class reloads

What does this MR do and why?

It seems that the is_a? check breaks on code reload, requiring a full rails restart on every single code change. It seems that under certain conditions, conn is of a different version of Gitlab::Redis::MultiStore than the one being used for the #is_a? check, causing the method to incorrectly yield conn instead of running the #with_borrowed_connection block below.

Since #with_borrowed_connection is unique to Gitlab::Redis::MultiStore, we can work around the problem with a #respond_to? instead of an #is_a? check until we figure out a better solution.

See #443675 (closed)

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
Screenshot_2024-02-28_at_14-52-49_NoMethodError_at__ Screenshot_2024-02-28_at_14-53-50_Projects___GitLab

How to set up and validate locally

  1. Visit your GDK start page
  2. Run touch app/models/merge_request.rb
  3. Reload the page

Expected results:

  • Without these changes, we get an error such as in the Before screenshot.
  • With these changes, the page loads

Merge request reports