added more config values for indexing + fixed value handling when Its missing in config file

This commit is contained in:
partisan 2024-12-30 17:19:20 +01:00
parent 047cccd19f
commit 13e1d6119b
3 changed files with 153 additions and 94 deletions

View file

@ -28,12 +28,12 @@ var (
bleveIndex bleve.Index
)
// startPeriodicIndexing refreshes the index from a file periodically
func startPeriodicIndexing(filePath string, interval time.Duration) {
go func() {
for {
printDebug("Refreshing index from %s", filePath)
err := IndexFile(filePath)
if err != nil {
if err := IndexFile(filePath); err != nil {
printErr("Failed to refresh index: %v", err)
}
time.Sleep(interval)
@ -139,7 +139,7 @@ func IndexFile(filePath string) error {
return fmt.Errorf("error reading file: %v", err)
}
printDebug("Indexed %d unique domains from %s\n", len(indexedDomains), filePath)
printDebug("Indexed %d unique domains from %s", len(indexedDomains), filePath)
return nil
}