weldr: Log when starting and finishing metadata preload
It is difficult to tell if these are really running in parallel or not, even with loggin, but it helps. They will all always start at the same time (because they are run concurrently with goroutines) and if things work right should be finished at about the same time.
This commit is contained in:
parent
c6a8d89da6
commit
2ab0430d5d
1 changed files with 3 additions and 0 deletions
|
|
@ -305,8 +305,10 @@ func (api *API) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
|||
// This starts a background depsolve for all known distros in order to preload the
|
||||
// metadata.
|
||||
func (api *API) PreloadMetadata() {
|
||||
log.Printf("Starting metadata preload goroutines")
|
||||
for _, distro := range api.distros {
|
||||
go func(distro string) {
|
||||
startTime := time.Now()
|
||||
d := api.getDistro(distro)
|
||||
if d == nil {
|
||||
log.Printf("GetDistro - unknown distribution: %s", distro)
|
||||
|
|
@ -324,6 +326,7 @@ func (api *API) PreloadMetadata() {
|
|||
if err != nil {
|
||||
log.Printf("Problem preloading distro metadata for %s: %s", distro, err)
|
||||
}
|
||||
log.Printf("Finished preload of %s in %v", distro, time.Since(startTime))
|
||||
}(distro)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue