diff --git a/Procfile b/Procfile index c2171a4..6f14c3e 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -ingestion: cd ingestion && INGEST_BRAIN_DIR=../brain INGEST_PORT=3300 go run ./cmd/server/ -supervisor: SUPERVISOR_CONFIG_DIR=./config/supervisor SUPERVISOR_MODELS_FILE=./config/models.yaml SUPERVISOR_SESSIONS_DIR=./brain/sessions INGEST_BASE_URL=http://localhost:3300 go run ./cmd/supervisor/ +ingestion: cd ingestion && INGEST_BRAIN_DIR=../brain INGEST_PORT=3300 INGEST_WATCH_INTERVAL=30 go run ./cmd/server/ +supervisor: SUPERVISOR_CONFIG_DIR=./config/supervisor SUPERVISOR_MODELS_FILE=./config/models.yaml SUPERVISOR_SESSIONS_DIR=./brain/sessions INGEST_BASE_URL=http://localhost:3300 INGEST_SVC_URL=http://localhost:3300 go run ./cmd/supervisor/ diff --git a/ingestion/cmd/server/main.go b/ingestion/cmd/server/main.go index 2f0c573..194f54a 100644 --- a/ingestion/cmd/server/main.go +++ b/ingestion/cmd/server/main.go @@ -2,6 +2,7 @@ package main import ( + "context" "fmt" "log/slog" "net/http" @@ -12,6 +13,7 @@ import ( "github.com/mathiasbq/hyperguild/ingestion/internal/api" "github.com/mathiasbq/hyperguild/ingestion/internal/llm" "github.com/mathiasbq/hyperguild/ingestion/internal/pipeline" + "github.com/mathiasbq/hyperguild/ingestion/internal/watcher" ) func envOr(key, fallback string) string { @@ -52,8 +54,14 @@ func main() { h := api.NewHandler(brainDir, logger, pipelineCfg) - // TODO(task11): start watcher when INGEST_WATCH_INTERVAL > 0 - _ = watchInterval + ctx := context.Background() + if watchInterval > 0 { + watcher.Start(ctx, watcher.Config{ + BrainDir: brainDir, + Interval: time.Duration(watchInterval) * time.Second, + Pipeline: pipelineCfg, + }) + } mux := http.NewServeMux() mux.HandleFunc("POST /query", h.Query) @@ -64,7 +72,7 @@ func main() { addr := ":" + port watchIntervalLog := "disabled" if watchInterval > 0 { - watchIntervalLog = fmt.Sprintf("%ds (pending task11 wiring)", watchInterval) + watchIntervalLog = fmt.Sprintf("%ds", watchInterval) } logger.Info("ingestion server starting", "addr", addr,