See the best posts from any Bluesky account
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Align backfill:run diagnostic with production's single-request path

The command was issuing getAuthorFeed plus four getPosts batches per
page to hydrate counts that getAuthorFeed already returns — the same
redundancy BackfillJob dropped. Parse the feed response directly so
the benchmark reflects what production actually costs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+11 -16
+11 -16
commands/backfill_run.ts
··· 4 4 createAtprotoClient, 5 5 AtprotoRequestEvent, 6 6 BlueskyRateLimitedError, 7 + parseGetAuthorFeedResponse, 7 8 } from '#lib/atproto/index' 8 9 import { HandleResolver } from '#services/handle_resolver' 9 10 ··· 124 125 let lastProgressLogAt = fetchedCount 125 126 126 127 try { 127 - outer: while (true) { 128 + while (true) { 128 129 pageCount += 1 129 130 const page = await atprotoClient.getAuthorFeed(did, cursor, 100) 130 - const uris = page.posts.map((f) => f.post.uri) 131 - 132 - for (let i = 0; i < uris.length; i += 25) { 133 - const uriBatch = uris.slice(i, i + 25) 134 - const posts = await atprotoClient.getPosts(uriBatch) 135 - fetchedCount += posts.length 136 - 137 - if (fetchedCount - lastProgressLogAt >= 500) { 138 - const elapsedSec = (Date.now() - startedAt) / 1000 139 - this.logger.info( 140 - `[progress] posts=${fetchedCount} pages=${pageCount} elapsed=${elapsedSec.toFixed(1)}s rate=${(fetchedCount / elapsedSec).toFixed(1)}/s` 141 - ) 142 - lastProgressLogAt = fetchedCount 143 - } 131 + const snapshots = parseGetAuthorFeedResponse({ feed: page.posts }, did) 132 + fetchedCount += snapshots.length 144 133 145 - if (fetchedCount >= this.max) break outer 134 + if (fetchedCount - lastProgressLogAt >= 500) { 135 + const elapsedSec = (Date.now() - startedAt) / 1000 136 + this.logger.info( 137 + `[progress] posts=${fetchedCount} pages=${pageCount} elapsed=${elapsedSec.toFixed(1)}s rate=${(fetchedCount / elapsedSec).toFixed(1)}/s` 138 + ) 139 + lastProgressLogAt = fetchedCount 146 140 } 147 141 142 + if (fetchedCount >= this.max) break 148 143 if (page.cursor === undefined) { 149 144 this.logger.info('[done] cursor exhausted') 150 145 break