Class: VersionTagFetcher Private
- Inherits:
-
Object
- Object
- VersionTagFetcher
- Defined in:
- lib/spm_version_updates/version_tag_fetcher.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Fetches git tag versions concurrently for cache-key/repository URL lookup pairs.
Class Method Summary collapse
-
.call(lookups, worker_limit:, persistent_cache: nil, raise_on_error: true) ⇒ Object
private
Fetch all lookups, returning ‘[results, errors]`, both keyed by cache key.
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(lookups, worker_limit, persistent_cache: nil, raise_on_error: true) ⇒ VersionTagFetcher
constructor
private
A new instance of VersionTagFetcher.
Constructor Details
#initialize(lookups, worker_limit, persistent_cache: nil, raise_on_error: true) ⇒ VersionTagFetcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of VersionTagFetcher.
56 57 58 59 60 61 62 |
# File 'lib/spm_version_updates/version_tag_fetcher.rb', line 56 def initialize(lookups, worker_limit, persistent_cache: nil, raise_on_error: true) @lookups = lookups @worker_limit = worker_limit @persistent_cache = persistent_cache @raise_on_error = raise_on_error @state = FetchState.build end |
Class Method Details
.call(lookups, worker_limit:, persistent_cache: nil, raise_on_error: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Fetch all lookups, returning ‘[results, errors]`, both keyed by cache key.
With ‘raise_on_error: true` (the default) any lookup failure is re-raised as one combined error after all workers finish; `errors` is then always empty. With `raise_on_error: false` failed lookups are returned in `errors` so the caller can degrade gracefully per package.
52 53 54 |
# File 'lib/spm_version_updates/version_tag_fetcher.rb', line 52 def self.call(lookups, worker_limit:, persistent_cache: nil, raise_on_error: true) new(lookups, worker_limit, persistent_cache:, raise_on_error:).call end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 70 71 |
# File 'lib/spm_version_updates/version_tag_fetcher.rb', line 64 def call queue = build_queue workers(queue).each(&:value) errors = @state.errors raise_lookup_error if @raise_on_error && !errors.empty? [@state.results, errors] end |