Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Nov 26, 2023
1 parent 27831c7 commit 067a0ce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 1 addition & 3 deletions artifactory/commands/transferfiles/filesdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ func generateDockerManifestAqlQuery(repoKey, fromTimestamp, toTimestamp string,

func generateAqlSortingPart(paginationOffset int, disabledDistinctiveAql bool) string {
sortingPart := fmt.Sprintf(`.sort({"$asc":["name","path"]}).offset(%d).limit(%d)`, paginationOffset*AqlPaginationLimit, AqlPaginationLimit)
if disabledDistinctiveAql {
sortingPart += `.distinct(false)`
}
sortingPart += appendDistinctIfNeeded(disabledDistinctiveAql)
return sortingPart
}
4 changes: 1 addition & 3 deletions artifactory/commands/transferfiles/fulltransfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ func generateFolderContentAqlQuery(repoKey, relativePath string, paginationOffse
query := fmt.Sprintf(`items.find({"type":"any","$or":[{"$and":[{"repo":"%s","path":{"$match":"%s"},"name":{"$match":"*"}}]}]})`, repoKey, relativePath)
query += `.include("repo","path","name","type","size")`
query += fmt.Sprintf(`.sort({"$asc":["name"]}).offset(%d).limit(%d)`, paginationOffset*AqlPaginationLimit, AqlPaginationLimit)
if disabledDistinctiveAql {
query += `.distinct(false)`
}
query += appendDistinctIfNeeded(disabledDistinctiveAql)
return query
}

Expand Down
6 changes: 2 additions & 4 deletions artifactory/commands/transferfiles/longpropertycheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (lpc *LongPropertyCheck) longPropertiesTaskProducer(progress *progressbar.T
if long := isLongProperty(property); long {
log.Debug(fmt.Sprintf(`Found long property ('@%s':'%s')`, property.Key, property.Value))
if lpc.producerConsumer != nil {
_, _ = lpc.producerConsumer.AddTaskWithError(lpc.createSearchPropertyTask(property, args, progress), lpc.errorsQueue.AddError)
lpc.producerConsumer.AddTaskWithError(lpc.createSearchPropertyTask(property, args, progress), lpc.errorsQueue.AddError)

Check failure on line 137 in artifactory/commands/transferfiles/longpropertycheck.go

View workflow job for this annotation

GitHub Actions / Static-Check

Error return value of `lpc.producerConsumer.AddTaskWithError` is not checked (errcheck)
}
if progress != nil {
progress.IncGeneralProgressTotalBy(1)
Expand Down Expand Up @@ -216,9 +216,7 @@ func (lpc *LongPropertyCheck) runSearchPropertyInFilesAql(serviceManager artifac
// Get the query that search files with specific property
func (lpc *LongPropertyCheck) getSearchPropertyInFilesQuery(property Property) string {
query := fmt.Sprintf(`items.find({"type": {"$eq":"any"},"@%s":"%s"}).include("repo","path","name")`, property.Key, property.Value)
if lpc.disabledDistinctiveAql {
query += `.distinct(false)`
}
query += appendDistinctIfNeeded(lpc.disabledDistinctiveAql)
return query
}

Expand Down
7 changes: 7 additions & 0 deletions artifactory/commands/transferfiles/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ func createSrcRtUserPluginServiceManager(ctx context.Context, sourceRtDetails *c
return NewSrcUserPluginService(serviceManager.GetConfig().GetServiceDetails(), serviceManager.Client()), nil
}

func appendDistinctIfNeeded(disabledDistinctiveAql bool) string {
if disabledDistinctiveAql {
return `.distinct(false)`
}
return ""
}

func runAql(ctx context.Context, sourceRtDetails *config.ServerDetails, query string) (result *serviceUtils.AqlSearchResult, err error) {
serviceManager, err := createTransferServiceManager(ctx, sourceRtDetails)
if err != nil {
Expand Down

0 comments on commit 067a0ce

Please sign in to comment.