Skip to content

Commit

Permalink
Remove extra call to get latest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Jan 6, 2025
1 parent 2e6af22 commit 2648d50
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions server/implementation/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,9 @@ func (s *DripStrictServerImplementation) SearchNodes(ctx context.Context, reques
apiNodes := make([]drip.Node, 0, len(nodeResults.Nodes))
for _, dbNode := range nodeResults.Nodes {
apiNode := mapper.DbNodeToApiNode(dbNode)
if dbNode.Edges.Versions != nil && len(dbNode.Edges.Versions) > 0 {
latestVersion, err := s.RegistryService.GetLatestNodeVersion(ctx, s.Client, dbNode.ID)
if err == nil {
apiNode.LatestVersion = mapper.DbNodeVersionToApiNodeVersion(latestVersion)
} else {
log.Ctx(ctx).Error().Msgf("Failed to get latest version for node %s w/ err: %v", dbNode.ID, err)
}
if len(dbNode.Edges.Versions) > 0 {
latestVersion := dbNode.Edges.Versions[0]
apiNode.LatestVersion = mapper.DbNodeVersionToApiNodeVersion(latestVersion)
}
apiNode.Publisher = mapper.DbPublisherToApiPublisher(dbNode.Edges.Publisher, false)
apiNodes = append(apiNodes, *apiNode)
Expand Down

0 comments on commit 2648d50

Please sign in to comment.