mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Amy's one-shot queries all go through Context.drain, a single REQ drained to EOSE — so a relay that caps its REQ response (strfry's per-REQ limit, ~500) silently truncates the result with no way to page past it. Extract the per-relay fetchAllPages fan-out that already lived privately in EventSync into a reusable quartz accessory, fetchAllPagesFromPool: a sliding-window pool (maxConcurrentRelays) that paginates each relay on its own `until` cursor, tags every event with its source relay, and does not dedup across relays. EventSync now delegates to it (its private downloadPool/ downloadFromRelay are deleted — no behavior change: perRelayFilters is already ordered by and complete over the relay list). Add Context.drainAllPages, the paged sibling of drain: same verify+store and per-relay tagging, but fully draining sets larger than one REQ. Wire it into `amy fetch` behind --paginate/--all (filter mode only), pushing the limit into the filter so paging stays bounded. sync (NIP-77) and fetch stay separate interfaces. Tests: fetchAllPagesFromPool fan-out/tagging/no-cross-relay-dedup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015YEbdqCRPkszkGCoi89RMt