Skip to content

Commit

Permalink
Merge branch 'main' into format
Browse files Browse the repository at this point in the history
  • Loading branch information
aeswibon authored Mar 28, 2024
2 parents 497014e + 9c31fdf commit 4a2df65
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion internal/repository/prisma/dbsqlc/get_group_key_runs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RETURNING "GetGroupKeyRun".*;

-- name: GetGroupKeyRunForEngine :many
SELECT
DISTINCT ON (ggr."id")
sqlc.embed(ggr),
-- TODO: everything below this line is cacheable and should be moved to a separate query
wr."id" AS "workflowRunId",
Expand All @@ -38,7 +39,7 @@ JOIN
JOIN
"WorkflowConcurrency" wc ON wv."id" = wc."workflowVersionId"
JOIN
"Action" a ON wc."getConcurrencyGroupId" = a."id"
"Action" a ON wc."getConcurrencyGroupId" = a."id" AND a."tenantId" = ggr."tenantId"
WHERE
ggr."id" = ANY(@ids::uuid[]) AND
ggr."tenantId" = @tenantId::uuid;
Expand Down
3 changes: 2 additions & 1 deletion internal/repository/prisma/dbsqlc/get_group_key_runs.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions internal/repository/prisma/dbsqlc/step_runs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ WHERE

-- name: GetStepRunForEngine :many
SELECT
DISTINCT ON (sr."id")
sqlc.embed(sr),
jrld."data" AS "jobRunLookupData",
-- TODO: everything below this line is cacheable and should be moved to a separate query
Expand All @@ -30,7 +31,7 @@ FROM
JOIN
"Step" s ON sr."stepId" = s."id"
JOIN
"Action" a ON s."actionId" = a."actionId"
"Action" a ON s."actionId" = a."actionId" AND s."tenantId" = a."tenantId"
JOIN
"JobRun" jr ON sr."jobRunId" = jr."id"
JOIN
Expand All @@ -57,6 +58,7 @@ WITH job_run AS (
WHERE "id" = @jobRunId::uuid
)
SELECT
DISTINCT ON (child_run."id")
child_run."id" AS "id"
FROM
"StepRun" AS child_run
Expand Down Expand Up @@ -86,6 +88,7 @@ WHERE

-- name: ListStepRuns :many
SELECT
DISTINCT ON ("StepRun"."id")
"StepRun"."id"
FROM
"StepRun"
Expand Down Expand Up @@ -362,7 +365,7 @@ valid_workers AS (
w."maxRuns" > (
SELECT COUNT(*)
FROM "StepRun" srs
WHERE srs."workerId" = w."id" AND srs."status" = 'RUNNING'
WHERE srs."workerId" = w."id" AND (srs."status" = 'RUNNING' OR srs."status" = 'ASSIGNED')
)
)
ORDER BY random()
Expand Down
7 changes: 5 additions & 2 deletions internal/repository/prisma/dbsqlc/step_runs.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/repository/prisma/dbsqlc/tickers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ WITH stepRunsToTimeout AS (
FROM
"StepRun" as stepRun
WHERE
"status" = 'RUNNING'
("status" = 'RUNNING' OR "status" = 'ASSIGNED')
AND "timeoutAt" < NOW()
AND (
NOT EXISTS (
Expand All @@ -101,7 +101,7 @@ WITH getGroupKeyRunsToTimeout AS (
FROM
"GetGroupKeyRun" as getGroupKeyRun
WHERE
"status" = 'RUNNING'
("status" = 'RUNNING' OR "status" = 'ASSIGNED')
AND "timeoutAt" < NOW()
AND (
NOT EXISTS (
Expand Down
4 changes: 2 additions & 2 deletions internal/repository/prisma/dbsqlc/tickers.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a2df65

Please sign in to comment.