{"slug":"cloudflare-cron-trigger-review","name":"Cloudflare Cron Trigger Review: Twice, Late, Never","version":"1.0.1","updated_at":"2026-11-22T15:16:10.425Z","use_when":"Reviews the scheduled() handler of a Cloudflare Worker that dispatches jobs every minute, and its watchdog, for runs that happen twice, at the wrong minute, late or not at all. Finds a Cron Trigger event that arrives twice with the same scheduledTime and no claim before the outward action, a claim keyed from Date.now() instead of scheduledTime, Math.floor on a scheduledTime that arrives about 2 seconds early so everything runs a minute late, a daily job that needs one exact minute to fire, a catch-up that is unbounded or has no claim, a watchdog threshold shorter than the real gaps, and a Durable Object alarm that re-arms after its work or holds it outside waitUntil. Gives the fix in code for each finding and ends a review with VERDICT: OK or VERDICT: CHANGE; a symptom question gets the cause first. Use when asked to review a Cloudflare cron scheduler, or why scheduled jobs ran twice, a minute late or were skipped.","not_for":"Failing job calls, retries, D1 errors or crashes, and the day-of-week numbering of cron expressions: other reviews cover those. It cannot read a live account or a log, so real gaps between wake-ups must come from the person. Cloudflare gives no delivery guarantee, and the figures in it were measured on one scheduler Worker in October 2026.","languages":["any"],"tags":["cloudflare","cron","scheduled","workers","durable-objects","scheduler","watchdog"],"category":"code","category_url":"https://aiskills402.com/categories/code","keywords":["Cron Trigger","scheduledTime","catch-up","Durable Object alarm"],"faq":[{"q":"Scheduler review: what comes back?","a":"Only what must change in a scheduled handler, each item tagged with a short code, its location, its cause and its fix. Nine codes cover a missing claim, a claim key taken from the clock, a minute computed with a plain floor, a job that needs one exact minute, a missing or unbounded catch-up, a watchdog threshold below the real gaps, and a Durable Object alarm that re-arms late or awaits its work. Safe look-alikes are listed apart. The last line is a verdict, OK or CHANGE."},{"q":"Can one cron minute really run a job twice?","a":"On our scheduler Worker, yes. On 12 October 2026 each minute brought two events, the second one to two minutes after the first, both stamped with the same minute. Two articles and a duplicate social post went out. The cure is a claim on the minute and the task, written with ON CONFLICT DO NOTHING before the action, keyed from the event's own time and never from the current clock."},{"q":"Why did every job start about a minute late?","a":"The event time arrived about two seconds before the minute, and flooring it gave the minute before. The job was then matched to the wrong minute and started late by a minute. Rounding to the nearest minute removed it. The same measurements showed skipped minutes, gaps up to eight minutes and some wake-ups twenty to forty-seven minutes late, so the skill also asks for a bounded catch-up."},{"q":"Does it help Claude Sonnet?","a":"Clearly, through three facts from our own measurements. The test: twelve job hubs on an every-minute trigger, five with a planted timing fault, five sound twins, two symptom questions. On its own Sonnet answered 7 correctly; given the skill, all 12. It already caught a missing claim and a claim keyed from Date.now(). It did not know that the event time comes two seconds early, so it approved Math.floor; that minutes get skipped, so a 07:00-only digest and a 2-minute watchdog looked fine; or that waitUntil keeps a Durable Object running. Haiku rose from 4 correct to 9."}],"examples":[{"lang":"en","model":"claude-sonnet-5-5","input_excerpt":"Before I deploy our job hub: one Cron Trigger (\"* * * * *\" in wrangler.jsonc) calls the code below every minute; the\njobs (about 20) and their cron expressions live in D1. fire() posts to the job URL and logs the status; failed calls\nshow up in our log and we rerun those by hand.\n\n// src/index.ts\n// D1: jobs(id, name, cron, url, enabled) · meta(key TEXT PRIMARY KEY, value INTEGER)…","output_excerpt":"**[NO-CLAIM]** in `runJob()` / `fire()`: nothing claims a (minute, job) pair before `fire()` posts to the job URL.\n\nCloudflare can deliver the same minute twice, and the second copy carries the same `scheduledTime` 1 to 2 minutes later. The pulse is written only at the end of `tick()`, after up to 30 s of calls.…"}],"page_url":"https://aiskills402.com/skills/cloudflare-cron-trigger-review","markdown_url":"https://aiskills402.com/skills/cloudflare-cron-trigger-review.md","image_url":"https://cdn.aiskills402.com/og/skills/cloudflare-cron-trigger-review/ab0b2994.png","related_url":"https://api.aiskills402.com/v1/skills/cloudflare-cron-trigger-review/related","purchases_count":null,"tested":{"date":"2026-11-22","strong":{"model":"claude-sonnet-5-5 (Claude Code alias \"sonnet\")","verdict":"Right on all 12 setups on the 1.0.1 bytes, read by hand. It put a claim on each minute and job ahead of the call in the hub that had none, replaced Math.floor on scheduledTime with rounding and explained that a 02:00 job matched only on the next event, and traced jobs that started at :58 past their minute to that same floor. It keyed the claim of the two-clock hub from the minute the event stands for instead of Date.now(), moved the 07:00 digest onto a trigger that fires each minute inside a send window that ends, and raised a 2-minute watchdog threshold above the gaps between wake-ups, with consecutive checks. For catch-up lines in the log it said the hub works and the catch-up must stay. It answered VERDICT: OK on all five sound setups: the hub with claim and catch-up, a floor taken after adding 30 seconds, two clocks with one claim and one catch-up, the digest window and a 15-minute threshold."},"weak":{"model":"claude-haiku-5-5 (Claude Code alias \"haiku\")","verdict":"Right on 9 of 12 on the 1.0.1 bytes, read by hand. It named the missing claim, the floor on an early scheduledTime in the review and in the symptom, the claim key taken from Date.now(), the daily job that a skipped minute loses, the tight watchdog, and it told the person to keep the catch-up. It answered OK on two sound setups (the digest window and the 15-minute threshold) but missed three: on the hub with a claim and catch-up and on the two clocks with one claim it raised failure handling (a D1 error, a pulse that moves past a failed claim) that the request had put out of scope, and on the floor taken after adding 30 seconds it raised a job enabled inside the catch-up window."},"note":"Twelve setups written by us around one scheduler Worker: five code reviews with a planted scheduling fault (no claim, a plain floor on scheduledTime, a claim key from Date.now() beside a second clock, a daily 0 7 * * * trigger, a 2-minute watchdog), five sound twins of them, and two questions about a symptom (jobs a minute late, catch-up lines in the log). Each answer is scored by code on the concept in any words: the verdict line, the cause and the fix (a claim, rounding or an offset before the floor, a key from the event's minute, an every-minute trigger or a catch-up, a threshold above the real gaps); a sound twin passes only with VERDICT: OK or nothing must change, and the catch-up question only when the catch-up is kept. Owner-measured on our scheduler Worker on 12 and 23 October 2026 and not re-checked here: two events per minute with one scheduledTime, the second one to two minutes later; up to 13 skipped minutes an hour, gaps up to 8 minutes, some wake-ups 20 to 47 minutes late; scheduledTime about 2 seconds before the minute; an alarm one second past each minute ringing 1.4 seconds late. Re-checked in the vendor documentation on 22 November 2026: in a Durable Object a promise given to waitUntil prevents eviction until it settles, for up to 15 minutes. Checks widened after reading the answers, for both sides: the two key values that differ, both claims that succeed, and a backtick before the variable name (a later `slot`) all count as the claim-key cause. Inputs fixed: before the skill was written, the sound twins claimed every job before calling any, the request scope now leaves failing calls and crashes out, and the digest window ends at 07:59; after the first run with the skill, the sound two-clock hub got a bounded catch-up from the shared pulse and both sides ran it again. The side with the skill was run in full on the final wording; after that run its three code examples were turned from fenced into indented blocks for the catalog's safety gate, words and code unchanged. One run per model and setup. The side with the skill was then run once more in full on the final bytes (both models): Sonnet 12 of 12 again, Haiku 9 of 12 (10 of 12 on the run before the formatting change; one run per model and setup, so Haiku moves by a case between runs). Version 1.0.1, 22 November 2026: the opening line had said that Cloudflare's documentation promises best effort; the page says no such thing (re-read that day: triggers run on underutilized machines, and runs can be missed while a change propagates), so the line now says the documentation gives no delivery guarantee. Two more sentences were reworded so that no published post on our blog shares a run of five words with the file. One check was widened for both sides: \"those differ\" and \"a different `Date.now()` key\" name the same claim-key cause. The side with the skill was run again in full on those bytes: Sonnet 12 of 12, Haiku 9 of 12. The side without the skill, re-scored with the same checks: unchanged, 7 and 4 of 12.","baseline":{"date":"2026-11-22","rows":[{"label":"Setups answered right (12 setups)","better":"higher","strong":{"with":{"n":12,"of":12},"without":{"n":7,"of":12}},"weak":{"with":{"n":9,"of":12},"without":{"n":4,"of":12}}}],"note":"Same request and checks on both sides. Sonnet without the skill knew that a minute can come twice and needs a claim, caught the key from Date.now(), kept the catch-up and answered OK on four of five sound twins. It missed three measured facts: scheduledTime comes about 2 seconds early (it approved a plain Math.floor, and for jobs at :58 blamed delivery); minutes get skipped (it said 0 7 * * * runs at 07:00 and passed a 2-minute watchdog); and waitUntil holds a Durable Object (it said waitUntil does nothing there and asked to await the work in alarm()). Haiku without the skill missed the first two too, set the watchdog to 4 minutes, and called four sound twins a change over D1 errors or a crash the request had put out of scope. With the skill Haiku still flagged two sound twins."},"report_url":null},"price_usd":"0.05","price_micro":50000,"size_bytes":13637,"sha256":"8b71a563696f1670c3020e76083592cc17e094a4b89aa2d852c280ef23353533","outline":["What was measured (on our scheduler Worker)","What to check, in this order","1. Claim before the outward action","2. The claim key comes from `scheduledTime`","3. Rounding the minute","4. A job must not need one exact minute to fire","5. Catch-up: bounded, and under the same claim","6. The watchdog threshold","7. A Durable Object alarm as the second clock","Answer format","Not a finding","What not to do"],"license":{"summary":"Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing","holder":"Georgi Kalchev, aiskills402.com","url":"https://aiskills402.com/docs#license"},"buy_url":"https://api.aiskills402.com/v1/skills/cloudflare-cron-trigger-review/file","redownload_url_template":"https://api.aiskills402.com/v1/purchases/{token}","mcp_tool":null,"payment":{"protocol":"x402","scheme":"exact","asset":"USDC","selling":true,"network":"base","network_caip2":"eip155:8453","pay_to":"0xbc0dcc70d8b5d85541d86ffc68d988fd59c22e68","facilitator":"cdp"},"seo_title":"Cloudflare Cron Trigger Review for Workers","seo_description":"Reviews a Cloudflare scheduled() handler for jobs that run twice, a minute late or never, and for a watchdog that cries wolf. Pay $0.05 once, in USDC.","versions":[{"version":"1.0.1","date":"2026-11-22","changelog":"# Changelog\n\n## 1.0.1 — 2026-11-22\n\nFact fixed: the file had said that Cloudflare's documentation promises best effort. Re-read on 22 November 2026, the page has no such words; it says that triggers run on underutilized machines and that runs can be missed while a change propagates. The opening line, a rule at the end and the listing now say that the documentation gives no delivery guarantee. Two other sentences reworded with the same meaning, so that no published post on our blog shares a run of five words with the file. One check widened for both sides. The side with the skill was run again in full, one run per model and setup: Sonnet 12 of 12, Haiku 9 of 12. Without the skill, re-scored: 7 and 4 of 12, unchanged.\n\n## 1.0.0 — 2026-11-22\n\n- First version.\n- Before publishing, after the first run with the skill: the watchdog section now ties the threshold to the silence\n  between wake-ups only. Events that arrive tens of minutes after their minute no longer argue for a longer threshold,\n  and a pulse stored after calls with a short timeout is no longer a finding. With the old wording Sonnet flagged a\n  sound 15-minute threshold that it had passed without the skill.\n- Before publishing: the section on a second clock now says that an alarm next to the cron does not make the catch-up\n  unnecessary, since each clock only handles the minute it woke in.\n- Test: the sound two-clock case had no catch-up, so a minute lost by both clocks was really lost; both models with the\n  skill said so. It now has a bounded catch-up from a shared pulse and is run again on both sides.\n- Test: the check for the claim-key cause also accepts \"both claims succeed\" for the two copies of one minute (a bare\n  Haiku answer named the right cause in those words). Widened for both sides.\n- Test: the same check also accepts a backtick before the variable name (\"gets a later `slot`\"). Haiku with the skill\n  named the right cause that way. Widened for both sides; test/control.mjs now checks that wording too.\n- Measured on 22 November 2026 on this text, one run per model and setup, 12 setups (5 reviews with a planted fault,\n  5 sound twins, 2 symptom questions): Claude Sonnet 12 of 12 with the skill, 7 of 12 without; Claude Haiku 10 of 12\n  with, 4 of 12 without. Sonnet's gain is five setups on three distinct facts: the early scheduledTime and the floor\n  (a review and a symptom), skipped minutes (a daily trigger and a 2-minute watchdog), and waitUntil inside a Durable\n  Object (a sound two-clock hub it wanted changed).\n- Price $0.05 (50000 micro): Sonnet gained five setups, on three distinct facts it did not know.\n- After the run, for the catalog's safety gate: the three code examples are indented blocks instead of fenced ones.\n  The words and the code are otherwise unchanged.\n- Skill side re-run in full on the final bytes, 22 November 2026: Sonnet 12 of 12, Haiku 9 of 12.\n"},{"version":"1.0.0","date":"2026-11-22","changelog":"# Changelog\n\n## 1.0.0 — 2026-11-22\n\n- First version.\n- Before publishing, after the first run with the skill: the watchdog section now ties the threshold to the silence\n  between wake-ups only. Events that arrive tens of minutes after their minute no longer argue for a longer threshold,\n  and a pulse stored after calls with a short timeout is no longer a finding. With the old wording Sonnet flagged a\n  sound 15-minute threshold that it had passed without the skill.\n- Before publishing: the section on a second clock now says that an alarm next to the cron does not make the catch-up\n  unnecessary, since each clock only handles the minute it woke in.\n- Test: the sound two-clock case had no catch-up, so a minute lost by both clocks was really lost; both models with the\n  skill said so. It now has a bounded catch-up from a shared pulse and is run again on both sides.\n- Test: the check for the claim-key cause also accepts \"both claims succeed\" for the two copies of one minute (a bare\n  Haiku answer named the right cause in those words). Widened for both sides.\n- Test: the same check also accepts a backtick before the variable name (\"gets a later `slot`\"). Haiku with the skill\n  named the right cause that way. Widened for both sides; test/control.mjs now checks that wording too.\n- Measured on 22 November 2026 on this text, one run per model and setup, 12 setups (5 reviews with a planted fault,\n  5 sound twins, 2 symptom questions): Claude Sonnet 12 of 12 with the skill, 7 of 12 without; Claude Haiku 10 of 12\n  with, 4 of 12 without. Sonnet's gain is five setups on three distinct facts: the early scheduledTime and the floor\n  (a review and a symptom), skipped minutes (a daily trigger and a 2-minute watchdog), and waitUntil inside a Durable\n  Object (a sound two-clock hub it wanted changed).\n- Price $0.05 (50000 micro): Sonnet gained five setups, on three distinct facts it did not know.\n- After the run, for the catalog's safety gate: the three code examples are indented blocks instead of fenced ones.\n  The words and the code are otherwise unchanged.\n- Skill side re-run in full on the final bytes, 22 November 2026: Sonnet 12 of 12, Haiku 9 of 12.\n"}]}