Skip to content

docs backend evidence cd ZD 02

AlexandreZanata edited this page Nov 5, 2026 · 1 revision

ZD-02 — Signal-aware HTTP drain

Status: LOCAL_DONE / INTEGRATION_PENDING Validation: PASS (local source; staging deployment OWED)

B-BR-CD-ZD-03: Given SIGTERM, readiness becomes 503 immediately while liveness and normal traffic continue during a configurable 0–30s delay (default 10s). Only after endpoint propagation does the listener close; in-flight requests may finish within the independent shutdown timeout.

BUC-CD-ZD-02: Kubernetes sends SIGTERM, the process withdraws readiness, continues accepting requests during propagation, gracefully shuts down, then exits successfully. No request context is tied to the canceled signal context. Worker dispatchers stop on that same cancellation; lease fencing/retry protects interrupted effects. No queue/schema behavior change is authorized here.

Invariant: drain delay + shutdown timeout + 5s < termination grace. The reviewed manifest will pin 10s + 10s + 5s < 60s (even max drain 30s fits).

B-BR-CD-ZD-04: A handler canceled by process shutdown must finalize its held lease using a separate bounded 5s acknowledgment context. Completed effects are acknowledged, interrupted handlers retain the existing retry budget and delay, and no new claims start. Database failure or stale fencing still fails; lease expiry remains the fallback. The process joins dispatchers before closing its pool and treats signal cancellation as a clean exit.

RED: config ignored bounds/defaults and SIGTERM closed the TCP listener; real PostGIS reproduced both completed/interrupted leases failing to finalize with context canceled. GREEN on parent 9bc48e20 plus this task:

  • go test -race -count=1 for config/httpserver/health/cmd/api/cmd/worker; actual child-process SIGTERM, readiness 503, fresh connections during the delay, upload finishing after http.Shutdown begins, process exit 0.
  • Entire jobs integration suite against exclusive tmpfs PostGIS: PASS (9.707s), including cancellation, retry/fencing/failure/concurrency cases.
  • Worker TestOverlappingWorkersDoNotDuplicateEffects: PASS (1.618s); existing cancellation unit test joins all dispatchers before claims.
  • Affected go vet, gofmt, actionlint 1.7.12, secret scan and diff-check PASS.

No migration or dependency changed. Worker previously used its canceled context for finalization, leaving leases until expiry; it now uses bounded fenced acknowledgment, joins loops before pool close and exits cleanly for signal cancellation. No live rollout or zero-downtime certification claimed.

Fuel prices wiki

Source: AlexandreZanata/brazil-fuel-prices @ 99f218303462287ad0d2122e065fa9d9759314ee

Clone this wiki locally