2.7 KiB
Rubygems datasource
Datasource query order depends on the registry.
Querying rubygems.org
Rubygems rate limits are easy to hit, so we need to be careful with the queries. This is implemented with two-level cache:
-
First, we query
https://rubygems.org/versions
endpoint for current versions for all packages.Either full or delta sync is performed, depending on the cache state.
All the data of this layer is stored in-memory as the mapping
packageName -> version[]
. -
Then, more data is obtained from
https://rubygems.org/api/v1/versions/<package>.json
andhttps://rubygems.org/api/v1/gems/<package>.json
.From the previous layer, the cache key is formed from the
packageName
, and the list of versions is additionally hashed and stored to ensure consistency, so that we reach these API endpoints only when the key has expired or when the list of versions has changed.The data for this cache layer is being persisted in the longer-term package cache.
Querying rubygems.pkg.github.com
or gitlab.com
These particular registries are queried using obsolete API
/api/v1/dependencies
Other registries
- Fetch from
/api/v1/versions/<package>.json
- Fallback to
/info/<package>
, if above fails - Fallback to the obsolete
/api/v1/dependencies
, if above fails