Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Speed up forge queries #50

Open
glennsarti opened this issue Feb 9, 2020 · 0 comments
Open

[Feature Request] Speed up forge queries #50

glennsarti opened this issue Feb 9, 2020 · 0 comments

Comments

@glennsarti
Copy link

According to

# Fetching metadata for all releases takes ages (which is weird, since it's mostly static info)
      mod.releases.take(FETCH_LIMIT).each do |rel|
        meta = get_release_metadata(name, rel)
        rel_artifact = @graph.artifact(name, rel.version)
        puts "...Recursively adding requirements for dependency #{name} version #{rel.version}"
        # We don't want to add the requirements to the list of demands for all versions,
        # but we need them in the graph to be able to solve dependencies
        add_reqs_to_graph(rel_artifact, meta, :no_demands)
      end

I had a similar problem when I wrote my Puppetfile Resolver. Ultimately I had to write my own HTTP query-er as the PuppetForge:Modules class is inflexible and is very costly as far as traffic and latency goes. (Doesn't batch query, doesn't reduce HTTP payload)

Here's my version which is purely used to fetch the metadata for all released versions.

https://github.com/lingua-pupuli/puppetfile-resolver/blob/master/lib/puppetfile-resolver/spec_searchers/forge.rb#L38-L73

It batches in lots of 50 and excludes a bunch of text files which are notorious for bloating HTTP payloads (:exclude_fields => 'readme changelog license reference tasks')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant