From 4f00a05152c105814f17a5f582d493435de96747 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Wed, 10 Jan 2018 01:30:04 +0800 Subject: Introduce PredicateMemoization cop and fix offenses with StrongMemoize --- lib/gitlab/github_import/client.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/gitlab/github_import/client.rb') diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 5da9befa08e..4f160e4a447 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -14,6 +14,8 @@ module Gitlab # puts label.name # end class Client + include ::Gitlab::Utils::StrongMemoize + attr_reader :octokit # A single page of data and the corresponding page number. @@ -173,7 +175,9 @@ module Gitlab end def rate_limiting_enabled? - @rate_limiting_enabled ||= api_endpoint.include?('.github.com') + strong_memoize(:rate_limiting_enabled) do + api_endpoint.include?('.github.com') + end end def api_endpoint -- cgit v1.2.1