chadtmiller.com/knotless
git that lives in your Atmosphere account
A private repository's language shows at once on a list after its first count
MergedThis 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
languagefield 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.
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
languagefield in the test. - No pruning of
PRIVATE_LANGUAGES.
They are still worth doing later.
8 passed, 2 skipped
What changes
A private repository's language on a list.
dev.knotless.getActorReposcounts 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.
getProfilecounts badges withspawn_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,
getActorReposfor chadtmiller.com took 1.5–2.7 s. Its trace showed private mirrors synced inline, onecom.atproto.space.getRecordto the owner's PDS taking 1.07 s.How it was checked
private_repositories_indexed_herenow 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