From fc425425b5f7d017daf2cbe5fa2e912b8da6d523 Mon Sep 17 00:00:00 2001 From: Seednode Date: Thu, 15 Feb 2024 18:01:54 -0600 Subject: [PATCH] Display time of next scheduled index rebuild --- cmd/index.go | 11 +++++++++++ cmd/root.go | 2 +- cmd/web.go | 1 - 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/index.go b/cmd/index.go index 878737e..0e35e39 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -316,15 +316,26 @@ func registerIndexInterval(paths []string, index *fileIndex, formats types.Types ticker := time.NewTicker(interval) + if Verbose { + next := time.Now().Add(interval).Truncate(time.Second) + fmt.Printf("%s | INDEX: Next scheduled rebuild will run at %s\n", time.Now().Format(logDate), next.Format(logDate)) + } + go func() { for { select { case <-ticker.C: + next := time.Now().Add(interval).Truncate(time.Second) + if Verbose { fmt.Printf("%s | INDEX: Started scheduled index rebuild\n", time.Now().Format(logDate)) } rebuildIndex(paths, index, formats, errorChannel) + + if Verbose { + fmt.Printf("%s | INDEX: Next scheduled rebuild will run at %s\n", time.Now().Format(logDate), next.Format(logDate)) + } case <-quit: ticker.Stop() diff --git a/cmd/root.go b/cmd/root.go index c1f4e46..5eb2d74 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,7 @@ import ( const ( AllowedCharacters string = `^[A-z0-9.\-_]+$` - ReleaseVersion string = "8.7.4" + ReleaseVersion string = "8.8.0" ) var ( diff --git a/cmd/web.go b/cmd/web.go index 7b1245d..b9e2673 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -317,7 +317,6 @@ func serveMedia(paths []string, index *fileIndex, filename *regexp.Regexp, forma // nonce := format.CSP(w) nonce := "" - mediaType := format.MediaType(filepath.Ext(path)) fileUri := Prefix + generateFileUri(path)