Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #673 +/- ##
==========================================
+ Coverage 94.48% 94.57% +0.09%
==========================================
Files 59 59
Lines 3246 3246
==========================================
+ Hits 3067 3070 +3
+ Misses 179 176 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Adversarial review completed across OpenCode, Claude, Codex, and Cursor.\n\nApplied:\n- deploy workflow uploads the updated Compose file and provisions the shared inference token\n- CPU triangulation runs off the event loop and remains serialized per process\n- backend exposes a stable 503 response without leaking upstream details\n- zero-angle cone compatibility and concurrency/health regression coverage\n\nKept intentionally:\n- notification timezone lookup failures skip delivery, matching the agreed best-effort policy\n- no Redis, local fallback, or shared geospatial abstraction without evidence they are needed |
6d997b7 to
c7fd372
Compare
Summary
Triangulation blocks the backend's event loop, so unrelated requests wait for the calculation. Run the same calculation in one bounded worker thread per backend process. Keep the current algorithm, results, dependencies, and deployment.
This replaces the original service extraction with a smaller latency fix: 5 files, +9 net production lines, +45 net lines including tests. Both alert attachment and alert refresh use the same worker limit.
flowchart LR C["Requests"] --> A subgraph B["Existing backend process"] A["API event loop"] -->|"await"| T["One geometry worker thread"] T -->|"same result"| A end A --> D["Database and storage"]Measured results and decision
Same optimized algorithm and package versions, one backend worker, five fresh runs per option:
mainRSS is resident process memory. The memory column includes backend and compute processes. The p95 is the response time within which 95% of health requests finish. Values are medians of each run's peak memory, p95 health time, and median calculation time.
The thread cuts unrelated-request tail latency by 98.1%, with 2.9% more RSS. Calculation time stays roughly unchanged. The split adds 34.1% RSS at one backend worker, so this PR adds no service, HTTP call, token, network, or dependency.
At four backend workers, a separate two-run experiment saved 12.8% RSS and 8.6% proportionally shared memory with the split. That is a different deployment from the repository's one-worker configuration. Native libraries remain in the backend in this PR; process and database isolation are deferred.
Raw samples, pinned environment, benchmark code, and reproduction instructions.
Conditions: native Linux ARM64, CPython 3.11.17, one CPU quota shared by the whole stack. Each mixed-load condition sends the same 12 geometry requests and 96 scheduled health requests. All geometry and timezone output hashes match across all 21 conditions.
Limits: these are local synthetic HTTP diagnostics with real backend imports. Database, S3, notification delivery, and background jobs are excluded. The split is an optimistic loopback prototype. These are not VPS ingestion measurements or Docker image-size savings.
Test plan
make quality;make precommit.