From 5c1ec7e4fc2901db1ce0ab29923f987f1c5ae147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Cor=C3=A9?= Date: Thu, 20 Jul 2023 22:16:53 +0200 Subject: [PATCH] Fix SQL query to get children jobs (#29) Also remove some Logger.info instances. --- cmd/sandbox-api/middlewares.go | 1 - internal/models/lifecycle_jobs.go | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/cmd/sandbox-api/middlewares.go b/cmd/sandbox-api/middlewares.go index 769ff0d2..15195c34 100644 --- a/cmd/sandbox-api/middlewares.go +++ b/cmd/sandbox-api/middlewares.go @@ -286,7 +286,6 @@ func ShortRequestID(next http.Handler) http.Handler { var err error requestID, err = gonanoid.New() - log.Logger.Info("Generating new request ID", "requestID", requestID) if err != nil { log.Logger.Error("Error generating request ID", "error", err) diff --git a/internal/models/lifecycle_jobs.go b/internal/models/lifecycle_jobs.go index d972a308..058a6f66 100644 --- a/internal/models/lifecycle_jobs.go +++ b/internal/models/lifecycle_jobs.go @@ -93,12 +93,6 @@ func GetLifecyclePlacementJob(dbpool *pgxpool.Pool, id int) (*LifecyclePlacement func GetLifecyclePlacementJobByRequestID(dbpool *pgxpool.Pool, requestID string) (*LifecyclePlacementJob, error) { var j LifecyclePlacementJob - log.Logger.Info("sql", - "sql", - "SELECT id, placement_id, status, request, lifecycle_action FROM lifecycle_placement_jobs WHERE request_id = $1", - "requestID", - requestID) - err := dbpool.QueryRow( context.Background(), "SELECT id, placement_id, status, request, lifecycle_action FROM lifecycle_placement_jobs WHERE request_id = $1", @@ -241,8 +235,7 @@ func (j *LifecyclePlacementJob) GlobalStatus() (string, error) { rows, err := j.DbPool.Query( context.TODO(), `SELECT id FROM lifecycle_resource_jobs - WHERE lifecycle_action = 'status' - AND parent_id = $1 + WHERE parent_id = $1 ORDER BY updated_at`, j.ID, )