Skip to content

Commit

Permalink
fix(store/github): load module cache before providers
Browse files Browse the repository at this point in the history
Because module loading is much faster.
  • Loading branch information
stigok committed Nov 25, 2024
1 parent c97005d commit ed87c9b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/terraform-registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ func gitHubRegistry(reg *registry.Registry) {
reg.SetModuleStore(store)
reg.SetProviderStore(store)

// Fill module store cache initially
logger.Debug("loading GitHub module store cache")
if err := store.ReloadCache(context.Background()); err != nil {
logger.Error("failed to load GitHub module store cache",
zap.Error(err),
)
}

// Fill provider store cache initially
if reg.IsProviderEnabled {
logger.Debug("loading GitHub provider store cache")
Expand All @@ -300,14 +308,6 @@ func gitHubRegistry(reg *registry.Registry) {
}
}

// Fill module store cache initially
logger.Debug("loading GitHub module store cache")
if err := store.ReloadCache(context.Background()); err != nil {
logger.Error("failed to load GitHub module store cache",
zap.Error(err),
)
}

// Reload store caches on regular intervals
go func() {
t := time.NewTicker(5 * time.Minute)
Expand Down

0 comments on commit ed87c9b

Please sign in to comment.