fix(cloudflare): give Catalog and commerce-customer-context a measured CPU budget - #1032
Conversation
…d CPU budget Every BFF request builds and disposes the whole Effect HTTP API runtime, so its CPU grows with the endpoint count. The 100 ms vertical cap cut off most requests to the two verticals with 200 and 115 endpoints (Cloudflare 1102). Stage analytics peaked at 2015 ms for successful requests and 2539 ms for the ones cut off, so they get a 3000 ms cap; every other vertical keeps 100 ms.
Changed Files
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why the change
Most requests to the stage Catalog and commerce-customer-context Workers die with Cloudflare error 1102 because they need far more CPU than the 100 ms vertical cap, and this gives those two Workers a cap based on what stage analytics actually measured.
Special things to note
wrangler tailshows every 1102 asexceededCpu, killed at 100 ms when warm and at ~2100 ms when cold.Change outline
CPU budgets
How each Worker picks its budget
createModernConfig({ ..., cloudflareCpuMs = vertical }) - createCloudflareDeployment(build, { name, unitServiceBindings }) // always vertical + createCloudflareDeployment(build, { cpuMs, name, unitServiceBindings }) commerce-customer-context/modern.config.ts + cloudflareCpuMs: largeApiVertical catalog/modern.config.ts - createCloudflareWorkerConfig(env, { cpuMs: vertical, ... }) + createCloudflareWorkerConfig(env, { cpuMs: largeApiVertical, ... })Generated
wrangler.jsonapp-catalog limits: { cpu_ms: 100 → 3000 } app-commerce-customer-context limits: { cpu_ms: 100 → 3000 } every other app-* Worker limits unchanged