LemmyClient: page-walking via page=N until cursor reached #16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
LemmyClient::fetchPostsSince()currently fetches a single page (?sort=New&limit=50) and stops. If a Lemmy instance posts more than 50 items between polls, the older items are dropped.MastodonClientdoesn't have this issue because it usesmin_idcursor semantics — the API returns everything newer thanmin_idin one response.Lemmy's
/api/v3/post/listdoesn't supportmin_id; pagination is page-based (page=1, 2, 3...) sorted by recency.Goal
Walk Lemmy pages forward from page=1 until reaching a post with
id <= last_seen_id, then stop. New high-water mark is the highestidseen across all walked pages (the first post on page 1).Acceptance criteria
id <= last_seen_id, or (b) page returns 0 posts, or (c) hard cap (e.g. 10 pages) reached as a safety net.Http::fake()that simulate 3 pages of posts spanning the cursor — confirm correct stop, correct cursor written, no infinite loop.Risks
timeout(10s)per request, but 10 pages × 10s = up to 100s per instance worst case. May want to factor into the scheduler'swithoutOverlapping(5)window or per-page timeout reduction.