mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 16:33:27 +00:00
The fixed 15s window-load timeout fired mid-flood on accounts with a large DM history: a relay streaming thousands of stored gift wraps never EOSE'd within 15s, so the window was declared "loaded" while events were still pouring in and before they were decrypted into rooms. The rooms list still looked empty, so auto-fill widened again — re-issuing an ever-wider REQ that re-downloaded the whole history, over and over, every 15s. WindowLoadTracker now completes a window on activity quiescence instead of a wall clock: it stays loading until every expected relay EOSEs, or the event stream goes quiet for a few seconds. Every event (stored backfill included) bumps the idle timer via onActivity, so a relay mid-flood is never mistaken for a finished window; an absolute cap bounds pathological dribble. Both DM loaders feed event activity in (the NIP-04 loader now uses a custom listener so it sees stored events, not just live ones). Also add a "Load entire history" button to the rooms-list footer: it jumps the window straight to the max lookback (TimeWindowPagination.loadAll) so a single REQ pulls everything — the pre-windowing behavior — and marks the window exhausted so the auto-fill loop stops.