GET /xrpc/app.bsky.actor.searchActorsTypeahead typeahead.waow.tech
16
fork

Configure Feed

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

resolve missing handles via slingshot in hourly cron

profile commits from Jetstream carry avatar/display_name but not
handles, so most ingested actors lack handles (22% coverage). the
hourly cron now resolves up to 200 missing handles per run via
slingshot, prioritizing recently updated actors. at 200/hour the
~22k backlog should clear in ~4-5 days.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+31
+31
src/index.ts
··· 136 136 } 137 137 } 138 138 139 + /** resolve handles for actors missing them via slingshot */ 140 + async function resolveHandles(env: Env): Promise<void> { 141 + const { results } = await env.DB.prepare( 142 + "SELECT did FROM actors WHERE handle = '' ORDER BY updated_at DESC LIMIT 200" 143 + ).all<{ did: string }>(); 144 + if (!results || results.length === 0) return; 145 + 146 + let resolved = 0; 147 + for (const { did } of results) { 148 + try { 149 + const res = await fetch( 150 + `${SLINGSHOT_URL}?identifier=${encodeURIComponent(did)}` 151 + ); 152 + if (!res.ok) continue; 153 + const identity: SlingshotResponse = await res.json(); 154 + if (identity.handle) { 155 + await env.DB.prepare( 156 + "UPDATE actors SET handle = ?1 WHERE did = ?2 AND handle = ''" 157 + ).bind(identity.handle, did).run(); 158 + resolved++; 159 + } 160 + } catch { 161 + // best-effort — skip failures 162 + } 163 + } 164 + if (resolved > 0) { 165 + console.log(JSON.stringify({ event: "handle_resolve", resolved, checked: results.length })); 166 + } 167 + } 168 + 139 169 /** fire-and-forget: increment hourly search count + accumulate response time */ 140 170 async function recordMetric(env: Env, ms: number): Promise<void> { 141 171 const hour = Math.floor(Date.now() / 3_600_000); ··· 934 964 export default { 935 965 async scheduled(_event: ScheduledEvent, env: Env, _ctx: ExecutionContext): Promise<void> { 936 966 await recordSnapshot(env); 967 + await resolveHandles(env); 937 968 }, 938 969 939 970 async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {