You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And it does produce the list of objects yes - but it also goes through every object one by one with GET (at least by looking Artifactory's access.log) - which means it takes about a minute to run this (with current amount of artifacts on search scope).
Is this intentional?
The text was updated successfully, but these errors were encountered:
I encountered the same issue while using this library.
The large number of request is due to from_url() method which is called for every single objects returned by a search request. This method calls Artifactory::Client::request at the end...
For my needs I have extended the Resource::Artifact class with a new method (in order to deal with NPM packages).
This method use an AQL query and then the from_url() method only once for the element which will be downloaded further...
So performances are improved since only 2 requests to the server are needed to return the searched object.
Code exemple:
defnpm(options={})client=extract_client!(options)repos=options[:repos]name=options[:name]version=options[:version]aql=%Q(items.find({"repo":"#{repos}"},{"@npm.name":"#{name}"},{"@npm.version":{"$match":"#{version}"}}).include("repo","name","path").sort({"$desc":["name"]}))results=client.post('/api/search/aql',aql)['results']if not results.empty?sorted=results.sort{|x,y| Gem::Version.new(x['name'].match(/-(\d+[\.\d-]+)\.tgz/)[1].gsub('-','.')) <=> Gem::Version.new(y['name'].match(/-(\d+[\.\d-]+)\.tgz/)[1].gsub('-','.'))}npm=sorted[-1]# Call from_url only once in order to improve performancesfrom_url(File.join('/api/storage/' + npm['repo'],npm['path'],npm['name']),client: client)elsenilendrescueError::HTTPError=>eraiseunlesse.code == 404nilend
Hi,
I'm trying to use the Artifactory.search() here like this:
And it does produce the list of objects yes - but it also goes through every object one by one with GET (at least by looking Artifactory's access.log) - which means it takes about a minute to run this (with current amount of artifacts on search scope).
Is this intentional?
The text was updated successfully, but these errors were encountered: