Skip to content

Commit

Permalink
Fix problem with function repos not loading
Browse files Browse the repository at this point in the history
Signed-off-by: John Belamaric <[email protected]>
  • Loading branch information
johnbelamaric committed Nov 20, 2023
1 parent 5d62251 commit 39e932d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion porch/pkg/cache/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,17 @@ func (r *cachedRepository) reconcileCache(ctx context.Context) error {
// TODO: Avoid simultaneous fetches?
// TODO: Push-down partial refresh?

// if this is not a package repo, just set the cache to "loaded" and return
if r.repoSpec.Spec.Content != configapi.RepositoryContentPackage {
r.mutex.Lock()
defer r.mutex.Unlock()
if r.cachedPackageRevisions != nil {
return nil
}
r.cachedPackageRevisions = make(map[repository.PackageRevisionKey]*cachedPackageRevision)
return nil
}

start := time.Now()
defer func() { klog.Infof("repo %s: refresh finished in %f secs", r.id, time.Since(start).Seconds()) }()

Expand Down Expand Up @@ -427,7 +438,7 @@ func (r *cachedRepository) reconcileCache(ctx context.Context) error {
for _, newPackage := range newPackageRevisions {
kname := newPackage.KubeObjectName()
if newPackageRevisionNames[kname] != nil {
klog.Warningf("repo %s: found duplicate packages with name %v", kname)
klog.Warningf("repo %s: found duplicate packages with name %v", r.id, kname)
}

pkgRev := &cachedPackageRevision{
Expand Down

0 comments on commit 39e932d

Please sign in to comment.