Files
Artstr-Studio/src
thePR0M3TH3AN 8439b358c3 Linked Designs P3d: batched prefetch on cold start
Last Phase 3 polish piece per LINKED_DESIGNS_FEATURE.md §14. The
cold-start path used to fire one parallel queryRelays per linked
layer — a host with 20 distinct linked sources opened 20 sockets
to each relay in the union. Now restoreAutosave issues one
batched relay round-trip via the new linkedDesigns.prefetchBatch.

Mechanics:

1. queryRelays accepts either a single filter object (existing
   callers) or an array of filters; arrays spread into the NIP-01
   REQ after the sub id (OR semantics). One-line change at the
   send site; zero impact on existing call sites.

2. prefetchBatch(specs) skips anything already in the in-memory
   cache, inflight map, or disk cache — partial cache hits only
   fetch what's missing. Distinct address-coord refs are grouped
   by (kind, pubkey) into one filter each (#d set of dTags);
   pinned event ids collapse into a single ids-filter. Events
   bucket by id (for pinned matches) and by address coord with
   latest created_at wins (for ref matches).

3. restoreAutosave's per-spec resolveLinked loop becomes a single
   prefetchBatch call. The disk-cache pre-filter inside
   prefetchBatch means a reload of a previously-resolved host
   pays zero network cost; only newly-linked refs hit the wire.

Per-layer resolveLinked calls in the renderer still work the way
they did — this only changes the bulk warm-up path. Interactive
adds (one new linked layer at a time) keep their single-filter
fast path.
2026-05-31 22:36:42 -04:00
..
2026-05-26 16:13:06 -04:00
2026-05-20 22:06:50 -04:00
2026-05-26 16:13:06 -04:00