GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 2d83e4c5 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'dz-project-list-cache-key' into 'master'

Improve project list cache key

Closes #31863

See merge request !11325
parents ec1a3c09 bbd1be00
......@@ -157,7 +157,15 @@ module ProjectsHelper
end
def project_list_cache_key(project)
key = [project.namespace.cache_key, project.cache_key, controller.controller_name, controller.action_name, current_application_settings.cache_key, 'v2.4']
key = [
project.route.cache_key,
project.cache_key,
controller.controller_name,
controller.action_name,
current_application_settings.cache_key,
'v2.4'
]
key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status?
key
......
......@@ -35,7 +35,7 @@ class Route < ActiveRecord::Base
old_path = route.path
# Callbacks must be run manually
route.update_columns(attributes)
route.update_columns(attributes.merge(updated_at: Time.now))
# We are not calling route.delete_conflicting_redirects here, in hopes
# of avoiding deadlocks. The parent (self, in this method) already
......
---
title: Use route.cache_key for project list cache key
merge_request: 11325
author:
......@@ -66,8 +66,8 @@ describe ProjectsHelper do
describe "#project_list_cache_key", redis: true do
let(:project) { create(:project) }
it "includes the namespace" do
expect(helper.project_list_cache_key(project)).to include(project.namespace.cache_key)
it "includes the route" do
expect(helper.project_list_cache_key(project)).to include(project.route.cache_key)
end
it "includes the project" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment