fix: seed rings without timing out on the biggest topic - #197
Merged
Conversation
…failed seed in minutes The first production seed died at the request deadline on the largest topic: the candidate query range-scanned every keyword row of the topic, joined, grouped and sorted them, and only then took a hundred; the size query counted the same join in full. Now both walk feeds in admission order with a primary-key probe into feed_keywords and stop at the rows they need (the size count stops at the minimum the caller asks about). A topic that still fails is counted and reported and the pass moves on, and the poller retries a failed seed ten minutes later instead of at the next six-hour mark, which is what the first deploy would have waited. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seed rings without timing out on the biggest topic
Follow-up to #196. The poller deployed, applied the migration and started the ring pass, and its first seeding attempt died after 30 s with
The operation was aborted due to timeout(event="rings-error", 08:52:10 UTC): Turso's per-request deadline, hit by the largest topic.topicRingCandidatesrange-scanned everyfeed_keywordsrow of the topic, joined, grouped and sorted them before thelimit 100;topicRingSizecounted the same join in full. AndlastRingSeedwas stamped before the call, so the next attempt was six hours away.topicRingCandidates: walkfeedsin admission order (feeds_created_idx) with anexistsprobe intofeed_keywords(its primary key), so the statement stops at the hundredth member of a big topic and costs a point lookup per feed on a small one.topicRingSize(db, slug, { cap }): the count stops atcap;seedTopRingspasses the minimum it is asking about. Exact without a cap (the existing tests), plus a test for the cap.seedTopRings: a topic that fails is counted (failed) and reported throughonError; the pass continues.lastRingSeedstamped after the pass; a thrown pass is retried ten minutes later; the seed tally is logged when anything was created, added or failed.Tests: db, ingest and poller suites pass (results in the session log).
🤖 Generated with Claude Code
https://claude.ai/code/session_01XYae2mH3khdwiXUVzcVMDw