From b26718b8d3fa07acd54156f8ab95944bd1f51c6b Mon Sep 17 00:00:00 2001 From: Claude Lin & Lay Date: Wed, 29 Apr 2026 00:30:16 +0900 Subject: [PATCH] fix(poller): lower pollComments cap from 30 to 10 to fit Worker subrequest budget (#134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #136 で導入した cap=30 でも本番環境で `Too many subrequests` が解消しないことを観測したため、`src/poller.ts` の `MAX_COMMENT_FETCHES_PER_REPO_PER_RUN` を 30 から 10 に引き下げる。1 fetch あたり Vectorize embed + D1 FTS upsert + Workers AI + Store DO 呼び出しなどの multi-subrequest overhead が乗るため、5 repos × 30 fetches × ~3-5 subrequests で 1000 budget を使い切っていた。 2026-04-28T15:15 UTC の :15 cron (再デプロイから約 33 分後) で 5 repos すべてが `fetches_issued=30/30, fetch_failures=30, Too many subrequests` を記録した観測に基づく。 cap=10 にすることで worst-case 5 × 10 = 50 fetches × ~5 subrequests ≈ 250 に収まり、parent overhead や他 poller の余地を残しつつ 1000 制限に十分収まる。 Refs #134 --- src/poller.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/poller.ts b/src/poller.ts index 227523d..afea067 100644 --- a/src/poller.ts +++ b/src/poller.ts @@ -68,8 +68,21 @@ const MAX_COMMENTS_EMBEDDED_PER_REPO = 30; * worst-case fan-out is 60 fetches per repo, which combined with diff / wiki * / issue pollers exhausts the budget on busy repos (issue #134, observed on * Liplus-Project/dipper_ai). Capping fetches keeps the comment surface's - * worst-case bounded; remaining parents are picked up on the next cron. */ -const MAX_COMMENT_FETCHES_PER_REPO_PER_RUN = 30; + * worst-case bounded; remaining parents are picked up on the next cron. + * + * Numeric history (issue #134): + * - PR #136 (merged 2026-04-27) introduced this cap at 30 as the initial + * defense. + * - 2026-04-28T15:15 UTC :15 cron observation (post-redeploy +33min): all + * 5 polled repos still hit `fetches_issued=30/30, fetch_failures=30, + * Too many subrequests`. The cap fires (warn `pollComments: fetch budget + * reached`), but the 1000-subrequest-per-invocation budget is exhausted + * before fetches reach 30. Each fetch carries multi-subrequest overhead + * (Vectorize embed + D1 FTS upsert + Workers AI + Store DO calls), so + * 5 repos × 30 fetches × ~3-5 subrequests easily blows past 1000. + * - Lowered to 10: worst-case 5 × 10 = 50 fetches × ~5 subrequests ≈ 250, + * leaving headroom for per-parent overhead and other pollers. */ +const MAX_COMMENT_FETCHES_PER_REPO_PER_RUN = 10; /** Maximum number of commits fetched in the forward (webhook-redundancy) phase * of the diff poller per repo per run.