Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/github_import/client_pool.rb')
-rw-r--r--lib/gitlab/github_import/client_pool.rb39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/gitlab/github_import/client_pool.rb b/lib/gitlab/github_import/client_pool.rb
deleted file mode 100644
index e8414942d1b..00000000000
--- a/lib/gitlab/github_import/client_pool.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module GithubImport
- class ClientPool
- delegate_missing_to :best_client
-
- def initialize(token_pool:, per_page:, parallel:, host: nil)
- @token_pool = token_pool
- @host = host
- @per_page = per_page
- @parallel = parallel
- end
-
- # Returns the client with the most remaining requests, or the client with
- # the closest rate limit reset time, if all clients are rate limited.
- def best_client
- clients_with_requests_remaining = clients.select(&:requests_remaining?)
-
- return clients_with_requests_remaining.max_by(&:remaining_requests) if clients_with_requests_remaining.any?
-
- clients.min_by(&:rate_limit_resets_in)
- end
-
- private
-
- def clients
- @clients ||= @token_pool.map do |token|
- Client.new(
- token,
- host: @host,
- per_page: @per_page,
- parallel: @parallel
- )
- end
- end
- end
- end
-end