Files
query-orchestration/cmd/querySyncRunner/main.go
T
Jay Brown a6e081e5cd Merged in feature/log-version (pull request #185)
inject and print version at startup for all services

* inject and print version

* coverage
2025-09-18 21:06:21 +00:00

67 lines
1.6 KiB
Go

// **Listens For**: Body Containing Document ID
//
// **Action**.
//
// Find the queries with no dependencies that do not have a valid result for a document.
//
// The reasoning for only extracting these is to start the query extraction process only for necessary queries, and the query runner will manage updating downstream dependencies.
//
// There are 2 situations that cause a query to show up in this list:
//
// The query has no required dependencies.
//
// All required dependencies have a valid result.
//
// An event with the document id is pushed to the DOCTEXT queue.
package main
import (
"context"
"log/slog"
"os"
querysyncrunner "queryorchestration/api/querySyncRunner"
resultsync "queryorchestration/internal/query/result/sync"
querysync "queryorchestration/internal/query/sync"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig/build"
queryc "queryorchestration/internal/serviceconfig/queue/query"
_ "github.com/lib/pq"
)
type QuerySyncConfig struct {
runner.BaseConfig[querysyncrunner.Body]
queryc.QueryConfig
}
func main() {
// Print version information before any environment checks
build.PrintVersionInfo("querySyncRunner")
ctx := context.Background()
cfg := &QuerySyncConfig{}
cfg.ControllerFunc = func() runner.Controller[querysyncrunner.Body] {
sync := resultsync.New(cfg)
svc := querysync.New(cfg, &querysync.Services{
ResultSync: sync,
})
c := querysyncrunner.New(&querysyncrunner.Services{
QuerySync: svc,
})
return &c
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
server.Listen(ctx)
}