From e658f9603c99ca6a8ef4c0292b2cdab2916fb09e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 13 Aug 2019 09:04:30 -0700 Subject: Only expire tag cache once per push Previously each tag in a push would invoke the Gitaly `FindAllTags` RPC since the tag cache would be invalidated with every tag. We can eliminate those extraneous calls by expiring the tag cache once in `PostReceive` and taking advantage of the cached tags. Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/65795 --- lib/gitlab/git_post_receive.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/gitlab/git_post_receive.rb b/lib/gitlab/git_post_receive.rb index 6c7f23a673c..24d752b8a4b 100644 --- a/lib/gitlab/git_post_receive.rb +++ b/lib/gitlab/git_post_receive.rb @@ -33,6 +33,12 @@ module Gitlab end end + def includes_tags? + enum_for(:changes_refs).any? do |_oldrev, _newrev, ref| + Gitlab::Git.tag_ref?(ref) + end + end + private def deserialize_changes(changes) -- cgit v1.2.1