summaryrefslogtreecommitdiff
path: root/lib/gitlab/checks/project_moved.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/checks/project_moved.rb')
-rw-r--r--lib/gitlab/checks/project_moved.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/checks/project_moved.rb b/lib/gitlab/checks/project_moved.rb
index 3a1c0a3455e..dfb2f4d4054 100644
--- a/lib/gitlab/checks/project_moved.rb
+++ b/lib/gitlab/checks/project_moved.rb
@@ -21,6 +21,10 @@ module Gitlab
end
def add_redirect_message
+ # Don't bother with sending a redirect message for anonymous clones
+ # because they never see it via the `/internal/post_receive` endpoint
+ return unless user.present? && project.present?
+
Gitlab::Redis::SharedState.with do |redis|
key = self.class.redirect_message_key(user.id, project.id)
redis.setex(key, 5.minutes, redirect_message)