diff --git a/e2e/specs/notifications.spec.ts b/e2e/specs/notifications.spec.ts index aa4822ce..239d8801 100644 --- a/e2e/specs/notifications.spec.ts +++ b/e2e/specs/notifications.spec.ts @@ -508,7 +508,7 @@ test("US-117 read a follow who is in none of your spaces", async ({seed, as}) => }) test("US-117 read a network feed whose relays answer from different depths", async ({seed, as}) => { - // A relay that fills its page has covered only as far back as the page reaches. + // Mirrors PAGE_SIZE: a full page covers only as far back as it reaches. const pageSize = 100 const recent = "the harbourmaster moved the moorings again" const deep = "the old crane was scrapped in the spring" @@ -527,13 +527,13 @@ test("US-117 read a network feed whose relays answer from different depths", asy }) indexer.follows(user.alice, [user.bob]) - // Bob's busy relay holds a page of the last two hours, his quiet one a week-old note. + // Bob's outbox holds a full page of recent notes, the indexer one week-old note. indexer.relayList(user.bob, {read: [outbox.url], write: [outbox.url, indexer.url]}) outbox.profile(user.bob, {name: "Bob Barker"}) outbox.note(user.bob, recent, at(1, MINUTE)) - // More than one page, so the page comes back full however the relay rounds it + // More than pageSize so the page comes back full. for (let minute = 2; minute <= pageSize + 10; minute++) { outbox.note(user.bob, `mooring report ${minute}`, at(minute, MINUTE)) } @@ -549,7 +549,7 @@ test("US-117 read a network feed whose relays answer from different depths", asy await expect(network.getByText(recent)).toBeVisible() - // A week back is days below where the busy relay has been asked about, so it is held. + // Below the stretch the outbox covered, so it is held until the scroll. await expect(network.getByText(deep)).toHaveCount(0) await network.locator(".card").last().scrollIntoViewIfNeeded() diff --git a/src/app/feeds.ts b/src/app/feeds.ts index dd6261e2..ac28d8c5 100644 --- a/src/app/feeds.ts +++ b/src/app/feeds.ts @@ -375,13 +375,13 @@ export type FeedLoadState = // nothing in it, and the two have to move the window differently. export type FeedSpan = {found: number; complete: boolean; exhausted: boolean} -// How far a span covered is set by its least generous relay, and quiet relays answer first. +// Relatively high because quiet relays eose first. const SPAN_THRESHOLD = 0.8 -// A relay that accepts a socket and then says nothing neither answers nor drops. +// Short because a relay can accept a socket and never eose. const SPAN_TIMEOUT = 3000 -// Aborting a request resolves it with what arrived, the same way closing it does. +// Abort resolves a request with what arrived. const spanSignal = (signal: AbortSignal) => AbortSignal.any([signal, AbortSignal.timeout(SPAN_TIMEOUT)]) @@ -534,7 +534,6 @@ export const makeFeed = ({ } } - // The one door into the feed, and anything older than it has reached waits for the window. const addEvents = (newEvents: TrustedEvent[]) => { const ready: TrustedEvent[] = [] @@ -647,7 +646,7 @@ export const makeFeed = ({ oldest = edge === undefined ? since : Math.min(edge, until - 1) } - // A span reaches further back than it covers, so its deepest events wait for the window. + // addEvents, not insertEvents: found can reach below oldest. addEvents(found) reach(oldest)