Prefetch kagane covers during the poll cycle #45

Closed
opened 2026-08-09 03:35:45 +07:00 by sulthan · 1 comment
Owner

Blocked by: #43

Part of #38

What to build

The poll cycle fetches a bookmarked kagane series' cover once and persists it, so the bytes are
already stored before any Reader opens the web UI. This is what takes the browser off the request
path in the normal case — and it is the precondition for the browser living on a machine that is
usually asleep.

The on-first-view fallback stays: a series bookmarked between cycles still shows its cover
immediately rather than waiting up to six hours.

Implementation decisions

  • The cover fetcher becomes a field on the poller struct, alongside the fetchers and clock already
    there. Both behaviours are driven through one poll cycle with fakes; no new seam.
  • When a kagane series is checked and no cover bytes are stored for its image id, the image is
    fetched through the browser and persisted.
  • Strictly best-effort. A cover failure is logged and affects neither the chapter-list result nor
    the series' check stamp. The poller keeps stamping its check time before fetching, so a series
    behind a broken browser waits out a full cooldown instead of retrying every tick.
  • Prefetch is kagane only. No other site's images are challenge-gated.
  • Nothing is refetched: a series whose cover is already stored costs no browser work.

Acceptance criteria

  • A poll cycle persists the cover for a kagane series that had none.
  • A second cycle does not refetch a cover that is already stored.
  • A failing cover fetch leaves the chapter-list result and the series check stamp exactly as a
    successful cycle without cover prefetch would.
  • A cycle with no cover fetcher wired behaves as it does today.
  • No cover fetch is issued for a non-kagane series.
  • go test ./... passes.

Blocked by

  • #43 — needs the cover read/write on the store.
Blocked by: #43 Part of #38 ## What to build The poll cycle fetches a bookmarked kagane series' cover once and persists it, so the bytes are already stored before any Reader opens the web UI. This is what takes the browser off the request path in the normal case — and it is the precondition for the browser living on a machine that is usually asleep. The on-first-view fallback stays: a series bookmarked between cycles still shows its cover immediately rather than waiting up to six hours. ## Implementation decisions - The cover fetcher becomes a field on the poller struct, alongside the fetchers and clock already there. Both behaviours are driven through one poll cycle with fakes; no new seam. - When a kagane series is checked and no cover bytes are stored for its image id, the image is fetched through the browser and persisted. - Strictly best-effort. A cover failure is logged and affects neither the chapter-list result nor the series' check stamp. The poller keeps stamping its check time before fetching, so a series behind a broken browser waits out a full cooldown instead of retrying every tick. - Prefetch is kagane only. No other site's images are challenge-gated. - Nothing is refetched: a series whose cover is already stored costs no browser work. ## Acceptance criteria - [ ] A poll cycle persists the cover for a kagane series that had none. - [ ] A second cycle does not refetch a cover that is already stored. - [ ] A failing cover fetch leaves the chapter-list result and the series check stamp exactly as a successful cycle without cover prefetch would. - [ ] A cycle with no cover fetcher wired behaves as it does today. - [ ] No cover fetch is issued for a non-kagane series. - [ ] `go test ./...` passes. ## Blocked by - #43 — needs the cover read/write on the store.
sulthan added the ready-for-agent label 2026-08-09 03:35:45 +07:00
Author
Owner

Implemented and opened PR #51: #51

The latest-chapter poller now receives the shared browser cover fetcher, checks persistent Kagane cover storage, prefetches only missing Kagane covers, and leaves chapter polling plus cooldown stamping unchanged when cover work fails. Shared image-id and content-type validation prevents invalid challenge responses from being persisted. Added deterministic coverage for missing, cached, failed, invalid, nil-fetcher, and non-Kagane paths. Verification: go test ./... passed.

Implemented and opened PR #51: https://gitea.violetcrown.my.id/sulthan/mangaBookmark/pulls/51 The latest-chapter poller now receives the shared browser cover fetcher, checks persistent Kagane cover storage, prefetches only missing Kagane covers, and leaves chapter polling plus cooldown stamping unchanged when cover work fails. Shared image-id and content-type validation prevents invalid challenge responses from being persisted. Added deterministic coverage for missing, cached, failed, invalid, nil-fetcher, and non-Kagane paths. Verification: `go test ./...` passed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sulthan/mangaBookmark#45