~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

A private repository's language shows at once on a list after its first count

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:serve/profile-fast

What changes

A private repository's language on a list. dev.knotless.getActorRepos counts a private repository's language from its mirror only the first time this server lists it. After that it answers with what it counted and syncs and counts again in the background, under the same viewer, so the next list has it.

Badges off the async workers. getProfile counts badges with spawn_blocking. Counting them for an account of many pulls is synchronous CPU work, which held up every other request on the same worker meanwhile.

Why

On prod, getActorRepos for chadtmiller.com took 1.5–2.7 s. Its trace showed private mirrors synced inline, one com.atproto.space.getRecord to the owner's PDS taking 1.07 s.

How it was checked

private_repositories_indexed_here now lists the owner's private repositories once more after they show, which takes the counted path. Left to CI.

Shortcomings

The first list after a restart still waits on each private mirror's sync. A private repository's language can be one push behind on the list until its background count finishes.

🤖 Generated with Claude Code

Approved

This pull does two things. getActorRepos now answers a private repository's language from a process-wide cache once it has counted it, and re-syncs and counts in the background. getProfile counts badges on spawn_blocking. I found nothing that has to change. The cache is only read after the list has already checked who may see the repository, and the background task runs under the same viewer, so I see no leak.

Two things to consider, neither blocking:

  • No dedupe: every list spawns a fresh mirror sync and count for each private repository. Repeated or concurrent lists of a large private account stack up PDS fetches. Skipping the spawn while one for that key is running would bound it.
  • Test coverage: the new assertion only checks that the names come back again. It doesn't check that the language is the cached one. CI's 100% gate probably reaches both branches, but a check on the language field would show that the cached path works.

Also, PRIVATE_LANGUAGES is never pruned, so entries for deleted or renamed repositories stay until restart. That is small. A background count that fails keeps the old value, which is reasonable.

Approved

Since my last review, the pull only merged main and added the Counted type alias for the PRIVATE_LANGUAGES map. Nothing else changed, and I found nothing new that must change.

My earlier notes were not blocking, and none were acted on:

  • No dedupe of the background sync and count for each private repository.
  • No assertion on the language field in the test.
  • No pruning of PRIVATE_LANGUAGES.

They are still worth doing later.

Merged as d93d1ae