Ensure listen port log entry displays before cache import

This commit is contained in:
Seednode 2023-09-26 11:24:14 -05:00
parent f782846f02
commit 2f2d7f90d3
3 changed files with 28 additions and 19 deletions

View File

@ -181,3 +181,23 @@ func registerCacheHandlers(mux *httprouter.Router, args []string, errorChannel c
return nil
}
func importCache(args []string) error {
skipIndex := false
if CacheFile != "" {
err := cache.Import(CacheFile)
if err == nil {
skipIndex = true
}
}
if !skipIndex {
_, err := fileList(args, &filters{}, "")
if err != nil {
return err
}
}
return nil
}

View File

@ -12,7 +12,7 @@ import (
)
const (
ReleaseVersion string = "0.95.1"
ReleaseVersion string = "0.95.2"
)
var (

View File

@ -436,24 +436,6 @@ func ServePage(args []string) error {
return ErrNoMediaFound
}
skipIndex := false
if CacheFile != "" {
err := cache.Import(CacheFile)
if err == nil {
skipIndex = true
}
}
if !skipIndex {
_, err := fileList(args, &filters{}, "")
if err != nil {
return err
}
}
mux := httprouter.New()
listenHost := net.JoinHostPort(Bind, strconv.Itoa(Port))
if Verbose {
@ -463,6 +445,13 @@ func ServePage(args []string) error {
)
}
err = importCache(args)
if err != nil {
return err
}
mux := httprouter.New()
srv := &http.Server{
Addr: listenHost,
Handler: mux,