From 52ab33a3fa1bd31e8e01ea8b9c89d8c08dbeff82 Mon Sep 17 00:00:00 2001
From: Sean McGivern <sean@gitlab.com>
Date: Wed, 31 Aug 2016 15:04:51 +0100
Subject: [PATCH] Expire commit view partial after a day

We rarely use Russian-doll caching in views, and when we do, it's
typically with a naturally-invalidating key. In the case of the commit
partial, though, the author lookup isn't part of the cache key - because
we're not going to use the state of the users table - and so a new email
address can take up to two weeks to show against the commits list.

Limiting this to a day still caches the partial for a healthy amount of
time, without as bad a worst case scenario.
---
 CHANGELOG                                    | 1 +
 app/views/projects/commits/_commit.html.haml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 7941a29d4ed70..f36ab3b2b21f1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,7 @@ v 8.12.0 (unreleased)
   - Added tests for diff notes
   - Add a button to download latest successful artifacts for branches and tags !5142
   - Remove redundant pipeline tooltips (ClemMakesApps)
+  - Expire commit info views after one day, instead of two weeks, to allow for user email updates
   - Add delimiter to project stars and forks count (ClemMakesApps)
   - Fix badge count alignment (ClemMakesApps)
   - Fix branch title trailing space on hover (ClemMakesApps)
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml
index fd888f41b1ed8..389477d09277d 100644
--- a/app/views/projects/commits/_commit.html.haml
+++ b/app/views/projects/commits/_commit.html.haml
@@ -7,7 +7,7 @@
 - cache_key = [project.path_with_namespace, commit.id, current_application_settings, note_count]
 - cache_key.push(commit.status) if commit.status
 
-= cache(cache_key) do
+= cache(cache_key, expires_in: 1.day) do
   %li.commit.js-toggle-container{ id: "commit-#{commit.short_id}" }
     = author_avatar(commit, size: 36)
 
-- 
GitLab