feat(shutdown): add graceful shutdown #530
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!530
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/graceful-shutdown"
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?
What
Add a coordinated graceful shutdown on
SIGINT/SIGTERM:buildRouternow returns afunc()that closes the auth middleware, releasing keyfunc's JWKS refresh goroutine (fixes #524)./readyzis backed by a caller-provided flag (Deps.Ready); on shutdown the daemon flips it not-ready before draining, so ingress/k8s stop routing new traffic while/healthzstays green.ReadHeaderTimeout/ReadTimeout/WriteTimeout/IdleTimeouton thehttp.Serverso the drain cannot hang on slow or leaky clients.WaitGroupand joined after shutdown so the process waits for it to observe cancellation before exiting.Why
Phase 9 task #120 — production readiness: predictable, ordered shutdown that drains in-flight work and releases background resources.
Testing
go build ./...go vet ./...go test -race -count=1 ./...— full suite passes/readyz503 while/healthzstays 200) andrunPreviewGCreturning promptly on context cancellation and on invalid configgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
StartCleanupwill stop via the signal context.Closes #120
Closes #524
3bb95d50da2b117e7e4c