summaryrefslogtreecommitdiff
path: root/migrations/025_task_budgets_and_availability.sql
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-08-04 20:10:25 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-08-04 20:10:25 +0000
commit0a410243dea33f204764000be81814e541dcae48 (patch)
treef91f8312af0bc70e5da8c254635118efe811dbef /migrations/025_task_budgets_and_availability.sql
parent2da86b009c76bb7688103da49a9125d35d3a1ed8 (diff)
Fix production wedge: propagate context to Google Calendar API calls
Three .Do() calls in google_calendar.go accepted a ctx parameter but never chained .Context(ctx) into the actual SDK call, so the existing global 60s request timeout never reached the blocking network call. One hung Google Calendar request wedged every DB/session-touching request path in production for three days (2026-08-01 through 2026-08-04), undetected because /health unconditionally returned 200 throughout. - Wire .Context(ctx) into GetUpcomingEvents, GetEventsByDateRange, and GetCalendarList. - Bound aggregateData's four external fetches with a per-fetch sub-context as defense-in-depth (only effective if the callee actually honors ctx -- documented as such, not oversold). - Make GetUpcomingEvents/GetEventsByDateRange fetch calendars concurrently instead of sequentially: a review of this fix caught that a shared per-fetch deadline over a sequential loop would starve calendars past the first under any real latency, silently caching partial results as complete. Concurrent fetches give every calendar an equal shot at the same deadline instead. - /health now does a real PingContext DB check instead of a static "ok" (Handler.PingDB, tested for both healthy and closed-DB cases). - Add internal/api/context_audit_test.go: an AST-based structural guard that fails any future .Do() call in google_*.go missing .Context(...) anywhere in its chain, so this class of bug can't silently recur. Verified by deliberately reintroducing the original bug against a backup and confirming the guard catches it. - Add scripts/health-watchdog.sh: cron job restarts the service if /health fails twice in a row, five minutes apart. go test ./... -race is green. Deployed and live-verified.
Diffstat (limited to 'migrations/025_task_budgets_and_availability.sql')
0 files changed, 0 insertions, 0 deletions