diigo-cache: a fill ends at the first page past the data

Seen live: "filled: 168 of 1 pages". diigo's total overstated by 100
(16744 vs 16644), so the walk went on to page 168, which diigo answered
empty with a total ≤ 100; the fill recomputed its page count from that,
ceil(total/100) = 1.

Now a page whose own total says the data ended before it ends the walk,
with the count set to the last page with items ("167 of 167"). Judged
by total, not by items, since the public cache may keep none of a page
that isn't the end. The known-pages estimate ignores zero totals. The
fake answers past-the-end pages as diigo does (no items, total 0).

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 05:08:12 -05:00
1 parent fd16c7db53
commit 4034fba76b
3 files changed
+22 -5

No files matched your search

+3
View File
@@ -96,6 +96,9 @@ class FakeGet extends RpcTarget {
for (let n = (page - 1) * count + 1; n <= Math.min(page * count, total); n += 1) {
items.push(dated ? datedItem(n, now, this.#dated === "deep" ? "deep_dee" : "dated_dan") : item(n));
}
// past the end, diigo answers no items and a total of 0 (observed
// 2026-10-07: the page after the last reported total ≤ 100)
if (items.length === 0) return JSON.stringify({ total: 0, items });
return JSON.stringify({ total: this.#dated === "overstated" ? total + OVERSTATEMENT : total, items });
}
}