mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
The time-slice history bounded re-downloads but couldn't tell "this relay is empty" from "this is a gap" — an empty time slice can sit above older messages, so the only stop was the 10-year maxLookback, and a wide late slice could pull a 20k-event firehose in one request. History now pages backward by until+limit, per relay (UntilLimitPager). Each round asks every not-yet-empty relay for up to 10000 events older than its own cursor, no since, so gaps are skipped: an empty page + EOSE is a gap-proof "nothing older on this relay" signal. A relay returning fewer than the limit is treated as its own cap, not exhaustion — only an empty page ends it. A relay answering CLOSED isn't "empty" (it may answer after the auth handshake), so the global exhausted flag flips only when a whole round advances no relay at all, which also stops the loop on a relay that keeps CLOSing. limit caps per-request volume too. Both NIP-04 history managers now paginate themselves (per relay, scoped) instead of following the gift-wrap slice; loadEverything pages to the end by auto-issuing the next round until exhausted. The live tail and the rooms-list stall-gate are unchanged. Filter builders gained an optional limit; the conversation NIP-04 helper exposes its outbox relay set + a per-relay until builder. https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW