Append newline to index rebuild HTTP response; remove unneeded error handling for index rebuild handler registration

This commit is contained in:
Seednode 2023-12-17 05:28:24 -06:00
parent e9a3ae5e58
commit fef51438c0
4 changed files with 3 additions and 18 deletions

View File

@ -433,12 +433,6 @@ Poll:
} }
} }
if filesMatched < 1 {
fmt.Println("No files matched")
return []string{}, nil
}
if Verbose { if Verbose {
fmt.Printf("%s | INDEX: Selected %d/%d files across %d/%d directories in %s\n", fmt.Printf("%s | INDEX: Selected %d/%d files across %d/%d directories in %s\n",
time.Now().Format(logDate), time.Now().Format(logDate),

View File

@ -173,16 +173,10 @@ func serveIndexRebuild(args []string, index *fileIndex, formats types.Types, err
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Ok")) w.Write([]byte("Ok\n"))
} }
} }
func registerIndexHandlers(mux *httprouter.Router, args []string, index *fileIndex, formats types.Types, errorChannel chan<- error) error {
registerHandler(mux, Prefix+"/index/rebuild", serveIndexRebuild(args, index, formats, errorChannel))
return nil
}
func importIndex(args []string, index *fileIndex, formats types.Types) error { func importIndex(args []string, index *fileIndex, formats types.Types) error {
if IndexFile != "" { if IndexFile != "" {
err := index.Import(IndexFile) err := index.Import(IndexFile)

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.3.1" ReleaseVersion string = "3.3.2"
) )
var ( var (

View File

@ -544,10 +544,7 @@ func ServePage(args []string) error {
registerHandler(mux, Prefix+"/version", serveVersion()) registerHandler(mux, Prefix+"/version", serveVersion())
if Index { if Index {
err = registerIndexHandlers(mux, args, index, formats, errorChannel) registerHandler(mux, Prefix+"/index/rebuild", serveIndexRebuild(args, index, formats, errorChannel))
if err != nil {
return err
}
err = importIndex(paths, index, formats) err = importIndex(paths, index, formats)
if err != nil { if err != nil {