mirror of
https://github.com/remorses/playwriter.git
synced 2026-09-14 16:37:40 +08:00
c95cb21189
Instead of combining browserCost + proxyCost into a single cloudSpend counter, track them separately with independent budgets. This lets operators set different limits for proxy bandwidth vs VM runtime. Schema (org table): - Restore proxySpendCents / proxyBudgetCents (proxy bandwidth) - Add browserSpendCents / browserBudgetCents (VM runtime) - Rename proxySpendPeriodStart → spendPeriodStart (shared period marker) - Keep lastCloudCreateAt for rate limiting Schema (cloudSession table): - Restore lastProxyCostCents (proxy cost baseline) - Add lastBrowserCostCents (browser cost baseline) cloud-api.ts connect handler: - Check both budgets independently before allowing new sessions - Reset both counters on billing period rollover scheduled.ts cron: - Compute proxy and browser deltas separately per session - Atomic increment both spend counters independently - Kill sessions if either budget is exceeded - Conditional baseline update uses WHERE on both previous values Migration adds new columns alongside existing ones (no renames needed since proxy columns were never dropped from D1). Session: ses_107161964ffefCyMno6mi5LtMr