A usage circuit breaker for Cloudflare Workers
Yingjie Zhao describes a self-facing circuit breaker that pauses cron jobs on his Workers-based news aggregator as monthly usage nears plan allowances.
- Products
- WorkersKVQueues
- Source
- Author experienceYingjie Zhao’s blog
- Author
- Yingjie Zhao
Key points
- Every five minutes, the cron scheduler queries the GraphQL Analytics API and the Observability Telemetry API for month-to-date usage across eight resources and caches it in KV. Between checks, it reads the cached state from KV.
- Thresholds differ by resource: every resource warns at 80%, but only resources with costly overages that pausing cron can reduce (KV operations, Queues, Observability) trip at 90% and recover below 85%. Workers requests and CPU only warn. The gap between trip and recover prevents oscillation.
- If the usage API fails, the breaker keeps its last known state. Warnings are deduplicated per resource per month and trip alerts once per month, sent by email and Feishu. The author reports that it caught an 82% KV-read spike early in a month, before reaching the trip threshold.
Original sources
Undated
A usage circuit breaker for Cloudflare Workers
Open original sourceYingjie Zhao describes a self-facing circuit breaker that pauses cron jobs on his Workers-based news aggregator as monthly usage nears plan allowances.
More to read
hiromsaeden: an unindexed D1 GROUP BY loop produced $2,129.00 in invoices on a hobby project
On 2026-11-18, Cloudflare Community user @hiromsaeden published a post-mortem of a personal hobby project. An unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows; an unintended loop triggered about 315,000 runs across two billing cycles. In the 15 October–15 November cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read. Invoice IN-83890481 was $529.88 USD (paid). Invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax). Total billed was $2,129.00 USD; the expected budget was about $20/month. Support cases #02408621 and #02434399 led to a one-time courtesy credit of $953.74 (including a held $275.00), leaving a final balance of $645.38 USD; support said no further adjustments would be made. These amounts are the author’s invoices and credits, not a Billflare case total in this guide.
opsfork: a MeloTTS retry loop produced a $391.50 Workers AI charge; a waiver was requested.
Cloudflare Community user opsfork (newsfork.com) asks for a full waiver of a $391.50 Workers AI charge for the billing period October 21 – November 20, 2026. The author says normal Workers AI spend is about $1–2 per day, but an unexpected incident involving the @cf/myshell-ai/melotts model sharply increased billable usage, mainly on November 18–19. According to the author, MeloTTS was scheduled for deprecation on November 20, 2026, yet repeated model failures began around November 17, before that date; those failures triggered a queue retry mechanism, and a defect in the author’s retry implementation amplified the failures, producing about 3.3 million queued messages. The author says almost all affected inference requests were failed or redundant retries of the same few video rendering jobs and produced no usable output. The author acknowledges responsibility for the retry defect, says the loop has been stopped, and lists safeguards already added, including retry limits, exponential backoff, a circuit breaker, and removal of MeloTTS. Requested resolution includes investigating the pre-deprecation failures, excluding the abnormal usage, waiving the amount attributable to the incident or issuing an equivalent one-time account credit, and a revised invoice; the author is willing to pay legitimate normal-usage charges. A formal billing adjustment request was submitted as Billing Support Case #02445560. Community MVP sjr replied that the author needs to work through the billing ticket and that the Community cannot help with billing issues. There is no Cloudflare staff reply on the public thread.
Cloudflare costs $5 a month, but the bill is not capped
不追高 (@Ariella1213) writes an X article explaining that Workers Paid’s $5 is a minimum, that per-product limits and budget alerts do not cap the account bill, and how denial-of-wallet requests, write amplification, delayed stops and background retries add cost.