A dame.is & pds.dad production bsky38.com

Add's some performance enchancements #58

Merged pds.dad
targeting main from feature/performance
Merged opened by and assigned to pds.dad
targeting main from feature/performance

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Throttle the labeler cursor write to changed frames or once per two seconds

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Add pool.ts: the ranked pool memoized per connection and keyed on total_changes()

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Serve leaderboard pages, random picks and search from the pool snapshot

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Read profile counts and site stats from the pool snapshot

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Pick the next top-posts pull from the pool snapshot instead of re-ranking per wake-up

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Count a top-posts pull when it starts so a crash mid-pull cannot pin the queue

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Collapse the three post_pulls upserts into one helper

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Spread the close-time reload across tabs with a random delay

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Add an opt-in timing test for the pool snapshot

BENCH=1 pnpm vitest run src/lib/server/pool.test.ts -t timings, at a 5k-member pool built from 20,000 nominations with up to 10 votes each:

cold snapshot 26.0 ms page (warm) 0.01 ms profile (warm) 0.02 ms random (warm) 0.01 ms search (warm) 0.01 ms stats (warm) 2.26 ms page after a write 25.10 ms

Warm reads are sub-millisecond and a write costs one ~25 ms recompute, confirming the 86 ms home page is now a single per-write-burst recompute rather than a re-rank on every read.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

Skip the post-close busywork for commits the indexer ignored

put/del returned nothing, so the Jetstream wiring enqueued an actor refresh and woke the top-posts job for every commit — including the ones the VOTING_CLOSES_AT freeze had just thrown away, and deletes of rows that were already gone. Each wake-up re-ranks the whole pool, so after the close that was one full RANKED pass per ignored event, forever.

Both now report whether the transaction wrote anything, and createCommitHandlers (lifted out of startJetstream so it can be tested) gates the enqueues and the info log on that.

Also hoists the twice-declared Tx alias into db/client.ts.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_019V4L2AWFJ2GL8iBub6SA9X

more ai changes

Commits 0