a080ca59d8
Implement v2 upload batch cleanup * Implement v2 upload batch cleanup * Merge remote-tracking branch 'origin/main' into jmathison/v2-upload-batch * Address upload batch review feedback * Raise batch worker coverage * Fix batch cleanup review issues Approved-by: Jay Brown
66 lines
1.5 KiB
Go
66 lines
1.5 KiB
Go
// **Listens For**: Body Containing Document ID.
|
|
//
|
|
// **Action**.
|
|
//
|
|
// Checks if the document is eligible for syncing.
|
|
//
|
|
// By validating: the client can_sync parameter.
|
|
//
|
|
// If eligible, send an event to the DOCCLEAN queue.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"os"
|
|
|
|
docsyncrunner "queryorchestration/api/docSyncRunner"
|
|
"queryorchestration/internal/client"
|
|
"queryorchestration/internal/document"
|
|
"queryorchestration/internal/document/batch/foldercleanup"
|
|
"queryorchestration/internal/document/batch/outcome"
|
|
documentsync "queryorchestration/internal/document/sync"
|
|
"queryorchestration/internal/server/runner"
|
|
"queryorchestration/internal/serviceconfig/build"
|
|
documentcleanc "queryorchestration/internal/serviceconfig/queue/documentclean"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
type DocSyncConfig struct {
|
|
runner.BaseConfig[docsyncrunner.Body]
|
|
documentcleanc.DocCleanConfig
|
|
}
|
|
|
|
func main() {
|
|
// Print version information before any environment checks
|
|
build.PrintVersionInfo("docSyncRunner")
|
|
|
|
ctx := context.Background()
|
|
|
|
cfg := &DocSyncConfig{}
|
|
|
|
cfg.ControllerFunc = func() runner.Controller[docsyncrunner.Body] {
|
|
cli := client.New(cfg)
|
|
doc := document.New(cfg)
|
|
docsync := documentsync.New(cfg, &documentsync.Services{
|
|
Document: doc,
|
|
Client: cli,
|
|
})
|
|
|
|
return docsyncrunner.New(&docsyncrunner.Services{
|
|
Document: docsync,
|
|
Outcome: outcome.New(cfg.GetDBQueries()),
|
|
Cleanup: foldercleanup.New(cfg),
|
|
})
|
|
}
|
|
|
|
server, err := runner.New(ctx, cfg)
|
|
if err != nil {
|
|
slog.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
server.Listen(ctx)
|
|
}
|