Merged in feature/remove-query (pull request #201)

remove query from codebase part 1

* remove query

* fix localstack run
This commit is contained in:
Jay Brown
2026-01-14 17:59:04 +00:00
parent ebf47c6013
commit 0ddae4f91e
167 changed files with 1059 additions and 20641 deletions
+40 -47
View File
@@ -1,66 +1,59 @@
// **Listens For**: Body Containing Document ID and Query ID
//
// **Action**.
//
// Run the query for the given document and store the result.
//
// Events with the document id and downstream query ids are pushed to the QUERY queue.
// DEPRECATED: This runner is deprecated and no longer has any functionality.
// It is left in place until deployment code is updated accordingly.
// See remove_query_plan.md for details on the query removal.
package main
import (
"context"
"log/slog"
"net/http"
"os"
"os/signal"
"syscall"
"time"
queryrunner "queryorchestration/api/queryRunner"
"queryorchestration/internal/query"
"queryorchestration/internal/query/result"
resultset "queryorchestration/internal/query/result/set"
resultsync "queryorchestration/internal/query/result/sync"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig/build"
queryc "queryorchestration/internal/serviceconfig/queue/query"
_ "github.com/lib/pq"
)
type QueryConfig struct {
runner.BaseConfig[queryrunner.Body]
queryc.QueryConfig
}
const serviceName = "queryRunner"
func main() {
// Print version information before any environment checks
build.PrintVersionInfo("queryRunner")
// Print version information
build.PrintVersionInfo(serviceName)
ctx := context.Background()
slog.Warn("DEPRECATED: " + serviceName + " is deprecated and no longer has any functionality. " +
"This service is left in place until deployment code is updated accordingly.")
cfg := &QueryConfig{}
// Start minimal HTTP server for health checks (required for cloud deployments)
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
})
cfg.ControllerFunc = func() runner.Controller[queryrunner.Body] {
que := query.New(cfg)
res := result.New(cfg, &result.Services{
Query: que,
})
sync := resultsync.New(cfg)
resset := resultset.New(cfg, &resultset.Services{
Result: res,
Query: que,
Sync: sync,
})
c := queryrunner.New(&queryrunner.Services{
ResultSet: resset,
})
return &c
server := &http.Server{
Addr: ":8080",
Handler: mux,
ReadHeaderTimeout: time.Minute,
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
go func() {
slog.Info("Starting health check server on port 8080")
if err := server.ListenAndServe(); err != http.ErrServerClosed {
slog.Error("Health check server error", "error", err)
}
}()
server.Listen(ctx)
// Wait for shutdown signal
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
sig := <-sigChan
slog.Info(serviceName+" received shutdown signal, exiting gracefully", "signal", sig.String())
// Gracefully shutdown the HTTP server
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := server.Shutdown(ctx); err != nil {
slog.Error("Error shutting down health check server", "error", err)
}
}