Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
473 changes: 473 additions & 0 deletions apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts

Large diffs are not rendered by default.

262 changes: 167 additions & 95 deletions apps/server/src/orchestration-v2/Orchestrator.ts

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions apps/server/src/orchestration-v2/ProjectionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,10 @@ function needsRecovery(
}
case "runtime":
return (
projection.runs.some((run) =>
["queued", "preparing", "starting", "running", "waiting"].includes(run.status),
projection.runs.some(
(run) =>
["preparing", "starting", "running", "waiting"].includes(run.status) ||
(run.status === "queued" && run.queueHeld !== true),
) ||
projection.runtimeRequests.some((request) => request.status === "pending") ||
projection.providerSessions.some(
Expand Down Expand Up @@ -3427,7 +3429,12 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
ELSE 0 END
)
SELECT thread_id FROM orchestration_v2_projection_runs
WHERE status IN ('queued', 'preparing', 'starting', 'running', 'waiting')
WHERE status IN ('preparing', 'starting', 'running', 'waiting')
UNION
-- A held queue already went through recovery; rereading it on
-- every boot costs a projection read per held thread.
SELECT thread_id FROM orchestration_v2_projection_runs
WHERE status = 'queued' AND json_extract(payload_json, '$.queueHeld') IS NOT 1
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Outdated
UNION
SELECT thread_id FROM orchestration_v2_projection_runtime_requests
WHERE status = 'pending'
Expand Down
Loading
Loading