BUG: API deploy handler uses request context — deployment cancelled on client disconnect #105
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
merge-ready
merge-ready
needs-checks
needs-checks
needs-rebase
needs-rebase
needs-review
needs-review
needs-rework
needs-rework
notplanned
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#105
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: HIGH
File & Line
internal/handlers/api.go:345Description
HandleAPITriggerDeploycallsh.deploy.Deploy(request.Context(), ...)directly with the HTTP request context. When the API client disconnects (or times out),request.Context()is cancelled, which propagates into the deploy service and cancels the build/deploy mid-operation.The HTML handler (
HandleAppDeployinapp.go:355) correctly usescontext.WithoutCancel(request.Context())and runs the deployment in a goroutine.Impact
Any API-triggered deployment will be cancelled if the HTTP client disconnects before the build finishes (which can take 30+ minutes). The deployment will be left in a partially-built state. This makes the API deploy endpoint essentially unreliable.
Suggested Fix
Use
context.WithoutCanceland run in a goroutine, same as the HTML handler. Return 202 Accepted immediately (which it already does, but after the deploy starts synchronously).