From d6e26dfc51a94be11ddaba76de507fa306afe324 Mon Sep 17 00:00:00 2001 From: Adrian Rudnik Date: Tue, 31 Oct 2023 21:27:10 +0100 Subject: [PATCH] Smaller code cleanups --- frontend/src/stores/base.ts | 2 +- service/internal/config/config.go | 2 -- service/internal/parser/worker.go | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/frontend/src/stores/base.ts b/frontend/src/stores/base.ts index a844a50a..0a45b3c7 100644 --- a/frontend/src/stores/base.ts +++ b/frontend/src/stores/base.ts @@ -2,7 +2,7 @@ import type { Ref } from 'vue' import { computed, ref } from 'vue' export interface StoreResource { - id: string + id: number | string } export function setupStore() { diff --git a/service/internal/config/config.go b/service/internal/config/config.go index d57bbf49..3f17c57d 100644 --- a/service/internal/config/config.go +++ b/service/internal/config/config.go @@ -44,8 +44,6 @@ func LoadWithDefaults(path string) *Config { // Create fallback configuration c := newConfig() - Logger.Info().Err(err).Msg("Could not load config, falling back to defaults") - // For the searchable paths, we prefer the users home directory as initial configuration homeDir, err := os.UserHomeDir() if err == nil { diff --git a/service/internal/parser/worker.go b/service/internal/parser/worker.go index 2d2661bd..134c3291 100644 --- a/service/internal/parser/worker.go +++ b/service/internal/parser/worker.go @@ -7,18 +7,18 @@ import ( ) type WorkerPool struct { - workerCount int - inputPathsChan <-chan *pipeline2.FilesForProcessorMsg - outputResultChan chan<- *pipeline2.DocumentToIndexMsg - outputBroadcastChan chan<- interface{} + workerCount int + inputPathsChan <-chan *pipeline2.FilesForProcessorMsg + outputResultChan chan<- *pipeline2.DocumentToIndexMsg + pushChan chan<- interface{} } -func NewWorkerPool(workerCount int, pathChan <-chan *pipeline2.FilesForProcessorMsg, resultChan chan<- *pipeline2.DocumentToIndexMsg, broadcastChan chan<- interface{}) *WorkerPool { +func NewWorkerPool(workerCount int, pathChan <-chan *pipeline2.FilesForProcessorMsg, resultChan chan<- *pipeline2.DocumentToIndexMsg, pushChan chan<- interface{}) *WorkerPool { return &WorkerPool{ - workerCount: workerCount, - inputPathsChan: pathChan, - outputResultChan: resultChan, - outputBroadcastChan: broadcastChan, + workerCount: workerCount, + inputPathsChan: pathChan, + outputResultChan: resultChan, + pushChan: pushChan, } } @@ -40,13 +40,13 @@ func (p *WorkerPool) doWork(progress *stats.ProcessProgress, m *stats.Metrics) { Logger.Warn().Err(err).Str("path", msg.AbsPath).Msg("Failed to parse file") // Notify the UI about the failure - p.outputBroadcastChan <- pusher.NewFileStatusPush(msg.AbsPath, "failed", err.Error()) + p.pushChan <- pusher.NewFileStatusPush(msg.AbsPath, "failed", err.Error()) continue } // Notify the UI about the file progress - p.outputBroadcastChan <- pusher.NewFileStatusPush(msg.AbsPath, "processed", "") + p.pushChan <- pusher.NewFileStatusPush(msg.AbsPath, "processed", "") Logger.Debug().Str("path", msg.AbsPath).Msg("Finished processing")