class Dependabot::Clients::GithubWithRetries
def initialize(max_retries: 3, **args)
def initialize(max_retries: 3, **args) args = DEFAULT_CLIENT_ARGS.merge(args) access_tokens = args.delete(:access_tokens) || [] access_tokens << args[:access_token] if args[:access_token] access_tokens << nil if access_tokens.empty? access_tokens.uniq! # Explicitly set the proxy if one is set in the environment # as Faraday's find_proxy is very slow. Octokit.configure do |c| c.proxy = ENV["HTTPS_PROXY"] if ENV["HTTPS_PROXY"] end args[:middleware] = Faraday::RackBuilder.new do |builder| builder.use Faraday::Retry::Middleware, exceptions: RETRYABLE_ERRORS, max: max_retries || 3 Octokit::Default::MIDDLEWARE.handlers.each do |handler| next if handler.klass == Faraday::Retry::Middleware builder.use handler.klass end end @clients = T.let( access_tokens.map do |token| Octokit::Client.new(args.merge(access_token: token)) end, T::Array[Octokit::Client] ) end