Skip to content

Commit

Permalink
POC: make sure we are querying nevra from cache with epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Nov 24, 2023
1 parent fea3f04 commit b9ece7c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tasks/migration/migrate_system_package_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"app/tasks"
"encoding/json"
"fmt"
"strings"
"sync"

"gorm.io/gorm"
Expand Down Expand Up @@ -180,6 +181,7 @@ func getEvraApplicability(udpateData []UpdateData) (string, string) {
return latestApplicable, latestInstallable
}

// nolint: funlen
func getPackageIDs(u SystemPackageRecord, i int, latestApplicable, latestInstallable string) (int64, int64) {
// get package_id for latest installable and applicable packages
if len(latestApplicable) == 0 && len(latestInstallable) == 0 {
Expand All @@ -196,6 +198,9 @@ func getPackageIDs(u SystemPackageRecord, i int, latestApplicable, latestInstall
installableInCache := true

if len(latestApplicable) > 0 {
if !strings.Contains(latestApplicable, ":") {
latestApplicable = fmt.Sprintf("0:%s", latestApplicable)
}
nevraApplicable := fmt.Sprintf("%s-%s", name, latestApplicable)
applicable, applicableInCache = memoryPackageCache.GetByNevra(nevraApplicable)
if applicableInCache {
Expand All @@ -204,6 +209,9 @@ func getPackageIDs(u SystemPackageRecord, i int, latestApplicable, latestInstall
}

if len(latestInstallable) > 0 {
if !strings.Contains(latestInstallable, ":") {
latestInstallable = fmt.Sprintf("0:%s", latestInstallable)
}
nevraInstallable := fmt.Sprintf("%s-%s", name, latestInstallable)
installable, installableInCache = memoryPackageCache.GetByNevra(nevraInstallable)
if installableInCache {
Expand Down

0 comments on commit b9ece7c

Please sign in to comment.