Commit 6a0178d8 authored by Rubén Dávila's avatar Rubén Dávila

Invalidate cache with project details when repository is updated

The partial using this cache key was showing stale information due to
the cache not being invalidated.
parent f646a8b9
...@@ -171,6 +171,7 @@ module ProjectsHelper ...@@ -171,6 +171,7 @@ module ProjectsHelper
key = [ key = [
project.route.cache_key, project.route.cache_key,
project.cache_key, project.cache_key,
project.last_activity_date,
controller.controller_name, controller.controller_name,
controller.action_name, controller.action_name,
Gitlab::CurrentSettings.cache_key, Gitlab::CurrentSettings.cache_key,
......
---
title: Invalidate cache with project details when repository is updated
merge_request: 19774
author:
type: fixed
...@@ -90,6 +90,10 @@ describe ProjectsHelper do ...@@ -90,6 +90,10 @@ describe ProjectsHelper do
expect(helper.project_list_cache_key(project)).to include(project.cache_key) expect(helper.project_list_cache_key(project)).to include(project.cache_key)
end end
it "includes the last activity date" do
expect(helper.project_list_cache_key(project)).to include(project.last_activity_date)
end
it "includes the controller name" do it "includes the controller name" do
expect(helper.controller).to receive(:controller_name).and_return("testcontroller") expect(helper.controller).to receive(:controller_name).and_return("testcontroller")
......
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