Expand description
DM catch-up: what our read relays hold for us that we don’t, fetched once each.
Each relay reconciles (NIP-77) only the window it hasn’t vouched for: from its cursor, less NIP-59’s backdating slack. On an established account that is a few kilobytes of fingerprints. What a relay names missing is fetched from that relay alone, so a wrap five relays hold comes down once, not five times. A relay that can’t reconcile walks its window in small pages instead. Everything commits as it lands, so a link that dies part-way keeps what came. Fetches wait for silence, not a total: a slow relay that keeps sending keeps its turn. A relay’s cursor advances only once its whole window is held.
Structs§
Constants§
- NIP59_
BACKDATE_ SLACK - NIP-59 backdates a wrap’s created_at by up to two days, so a window that reaches back to a cursor has to start this much before it.
- RETRY_
BACKOFF_ SECS - After an incomplete catch-up, the waits before each retry: soon, then less often.
- SAFETY_
NET_ SECS - A catch-up this often while the app runs: a live subscription can die without a word, and the window since the last one is a few fingerprints.
Functions§
- catch_
up - Catch up on DMs over the read relays (or
opts.only). Each event goes throughcommit(a shell’s own commit, which may intercept, around the core one) with the sharedbatcherholding the persists. - retry_
incomplete - Retry what a catch-up left incomplete, backing off, until every relay is held or
the account is swapped out.
runcatches up the relays it’s given. - start_
safety_ net - Catch up every
SAFETY_NET_SECSfor as long as this account is the one logged in. Once per account however often it’s called.