Files
query-orchestration/cmd/querySyncRunner/main.go
T
Michael McGuinness fee71e7740 Merged in feature/postprocessing (pull request #114)
Feature/postprocessing

* tests

* passtest

* fixshorttests

* mosttests

* improvingbasedockerfile

* testspeeds

* testing

* host

* canparallel

* clean

* passfullsuite

* singlepagemax

* test

* findfeatures

* findstables

* tbls

* tablestoo

* tablestoo

* lateraltests

* tableloc

* cleanup

* inlinetable

* childids

* cleanup

* tests
2025-04-22 14:40:16 +00:00

63 lines
1.5 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"
queryc "queryorchestration/internal/serviceconfig/queue/query"
_ "github.com/lib/pq"
)
type QuerySyncConfig struct {
runner.BaseConfig[querysyncrunner.Body]
queryc.QueryConfig
}
func main() {
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)
}