From 7126fb28c08dd50c219a943c8217340dfc8a5809 Mon Sep 17 00:00:00 2001 From: t8y2 Date: Tue, 20 Oct 2026 19:01:59 +0800 Subject: [PATCH] chore(plugin-stats): slow resume cron to hourly to cut KV writes --- deploy/plugin-stats-worker/README.md | 7 +++++-- deploy/plugin-stats-worker/wrangler.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/deploy/plugin-stats-worker/README.md b/deploy/plugin-stats-worker/README.md index 646b34efdb..1651caba54 100644 --- a/deploy/plugin-stats-worker/README.md +++ b/deploy/plugin-stats-worker/README.md @@ -64,8 +64,11 @@ aggregation stalled silently for three weeks (2026-09-28 → 2026-10-20) while raw AE data kept flowing. Now every invocation processes at most `chunk` keys (tuning halves on failure, creeps up on success, 8–400), persists its cursor in `agg:state`, and completes the summary write + watermark advance only when the -pass finishes. Crons: `30 0 * * *` opens the day's window, `*/10 * * * *` -resumes any in-flight pass. AE row order is normalized with a JS sort because +pass finishes. Crons: `30 0 * * *` opens the day's window, `0 * * * *` +resumes any in-flight pass (a normal window finishes in a few ticks ≈ hours; +the hourly cadence keeps daily KV writes under the free-plan 1000/day alert +line — freshness is a decorative concern here, raise the frequency only if +display latency starts to matter). AE row order is normalized with a JS sort because the offset cursor must index identically across invocations. Required subrequests per invocation: `chunk`-bounded (~2·chunk + 6) — never the whole backlog. After deploying schema-affecting changes, or to backfill from scratch, diff --git a/deploy/plugin-stats-worker/wrangler.json b/deploy/plugin-stats-worker/wrangler.json index bd877910bd..420909badd 100644 --- a/deploy/plugin-stats-worker/wrangler.json +++ b/deploy/plugin-stats-worker/wrangler.json @@ -30,7 +30,7 @@ "triggers": { "crons": [ "30 0 * * *", - "*/10 * * * *" + "0 * * * *" ] } }