0ddae4f91e
remove query from codebase part 1 * remove query * fix localstack run
60 lines
1.7 KiB
Go
60 lines
1.7 KiB
Go
// 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"
|
|
|
|
"queryorchestration/internal/serviceconfig/build"
|
|
)
|
|
|
|
const serviceName = "queryVersionSyncRunner"
|
|
|
|
func main() {
|
|
// Print version information
|
|
build.PrintVersionInfo(serviceName)
|
|
|
|
slog.Warn("DEPRECATED: " + serviceName + " is deprecated and no longer has any functionality. " +
|
|
"This service is left in place until deployment code is updated accordingly.")
|
|
|
|
// 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)
|
|
})
|
|
|
|
server := &http.Server{
|
|
Addr: ":8080",
|
|
Handler: mux,
|
|
ReadHeaderTimeout: time.Minute,
|
|
}
|
|
|
|
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)
|
|
}
|
|
}()
|
|
|
|
// 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)
|
|
}
|
|
}
|