Commit 7da13fee authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Add a simple cache for Gitlab::GithubImport::Client#user

parent ca5be10bb92f
......@@ -10,6 +10,7 @@ def initialize(access_token, host: nil, api_version: 'v3')
@access_token = access_token
@host = host.to_s.sub(%r{/+\z}, '')
@api_version = api_version
@users = {}
if access_token
::Octokit.auto_paginate = false
......@@ -64,6 +65,13 @@ def respond_to?(method)
api.respond_to?(method) || super
def user(login)
return nil unless login.present?
return @users[login] if @users.key?(login)
@users[login] = api.user(login)
def api_endpoint
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