8000 refactor: add comment to SQL query · coder/coder@3cc74fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 3cc74fb

Browse files
refactor: add comment to SQL query
1 parent ed14fb3 commit 3cc74fb

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

coderd/database/querier.go

Lines changed: 5 additions & 0 deletions
Some generated f 8000 iles are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/prebuilds.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ WHERE pj.job_status IN ('pending'::provisioner_job_status, 'running'::provisione
4747
GROUP BY t.id, wpb.template_version_id, wpb.transition;
4848

4949
-- name: GetPresetsBackoff :many
50+
-- GetPresetsBackoff groups workspace builds by template version ID.
51+
-- For each group, the query checks the last N jobs, where N equals the number of desired instances for the corresponding preset.
52+
-- If at least one of the last N jobs has failed, we should backoff on the corresponding template version ID.
53+
-- Query returns a list of template version IDs for which we should backoff.
54+
-- Only template versions with configured presets are considered.
5055
WITH filtered_builds AS (
5156
-- Only select builds which are for prebuild creations
5257
SELECT wlb.*, tvp.id AS preset_id, pj.job_status, tvpp.desired_instances

0 commit comments

Comments
 (0)
0