dev/refactor #1

Closed
ryan wants to merge 16 commits from dev/refactor into main
Owner

What changed

Critical fix — Plex sync hang

The app would hang indefinitely after logging "Syncing Plex labels for N items..."
and never schedule the next run. One stuck HTTP request inside p-queue's addAll
would block the entire batch with no per-task timeout. Could sit like that for days.

Replaced p-queue with Promise.allSettled + a per-task withTimeout on every
Plex item. One stuck request times out in 30s and logs an error, the rest continue.

Pipeline restructure

  • Letterboxd→Radarr and Serializd→Sonarr run in parallel
  • Plex runs once at the end, after both arr syncs finish
  • Items newly added to arr apps are skipped in Plex — they get tagged on the next run once
    they actually exist in the library
  • Plex library index is prefetched in the background at startup so it's warm
    by the time the Plex phase runs

Dropped p-queue, Bottleneck handles concurrency

  • src/util/queues.tssrc/util/limiters.ts
  • Two Plex limiters collapsed into one
  • retry.ts now uses exponential backoff with per-attempt timeouts

Consolidated Letterboxd scraper

Three near-identical scrapers (list.ts, collections.ts, popular.ts) plus
a base class, collapsed into a single letterboxd.ts. Also dropped fetch
for Axios to match patterns

Serializd fixes

  • Fixed API base URL after upstream update
  • Fixed public list parsing — the API returns a listItems key with a singular
    seasonId per item, not shows/items with seasonIds
  • Fixed URL pattern matching for all three list formats

Publish script (Depreciated)

  • Broke main() into named phase functions for readability
  • Multi-registry Docker push with an "All" default (Forgejo + GHCR)
  • "Go back" navigation between phases
  • GitHub Releases support

Warning

The publish script has moved to an app-agnostic cli-tool here: https://forgejo.dawes.cc/ryan/release-cli

Files deleted

src/api/plex.ts, src/api/radarr.ts, src/api/sonarr.ts — replaced by
flat src/plex.ts, src/radarr.ts, src/sonarr.ts

src/scraper/list.ts, collections.ts, popular.ts, movie.ts,
scraper.base.ts, scraper.interface.ts, index.ts — replaced by
src/scraper/letterboxd.ts

src/util/queues.ts, src/util/tagHelper.ts, src/util/context.ts

## What changed ### Critical fix — Plex sync hang The app would hang indefinitely after logging "Syncing Plex labels for N items..." and never schedule the next run. One stuck HTTP request inside p-queue's `addAll` would block the entire batch with no per-task timeout. Could sit like that for days. Replaced p-queue with `Promise.allSettled` + a per-task `withTimeout` on every Plex item. One stuck request times out in 30s and logs an error, the rest continue. ### Pipeline restructure - Letterboxd→Radarr and Serializd→Sonarr run in parallel - Plex runs once at the end, after both arr syncs finish - Items newly added to arr apps are skipped in Plex — they get tagged on the next run once they actually exist in the library - Plex library index is prefetched in the background at startup so it's warm by the time the Plex phase runs ### Dropped p-queue, Bottleneck handles concurrency - `src/util/queues.ts` → `src/util/limiters.ts` - Two Plex limiters collapsed into one - `retry.ts` now uses exponential backoff with per-attempt timeouts ### Consolidated Letterboxd scraper Three near-identical scrapers (`list.ts`, `collections.ts`, `popular.ts`) plus a base class, collapsed into a single `letterboxd.ts`. Also dropped `fetch` for Axios to match patterns ### Serializd fixes - Fixed API base URL after upstream update - Fixed public list parsing — the API returns a `listItems` key with a singular `seasonId` per item, not `shows`/`items` with `seasonIds` - Fixed URL pattern matching for all three list formats ### Publish script (**Depreciated**) - Broke `main()` into named phase functions for readability - Multi-registry Docker push with an "All" default (Forgejo + GHCR) - "Go back" navigation between phases - GitHub Releases support > [!WARNING] > The publish script has moved to an app-agnostic cli-tool here: https://forgejo.dawes.cc/ryan/release-cli ## Files deleted `src/api/plex.ts`, `src/api/radarr.ts`, `src/api/sonarr.ts` — replaced by flat `src/plex.ts`, `src/radarr.ts`, `src/sonarr.ts` `src/scraper/list.ts`, `collections.ts`, `popular.ts`, `movie.ts`, `scraper.base.ts`, `scraper.interface.ts`, `index.ts` — replaced by `src/scraper/letterboxd.ts` `src/util/queues.ts`, `src/util/tagHelper.ts`, `src/util/context.ts`
ryan added 16 commits 2026-04-21 16:02:59 +00:00
ryan self-assigned this 2026-04-21 16:04:34 +00:00
ryan closed this pull request 2026-04-21 16:19:27 +00:00
Author
Owner

closed by 8e29328482

closed by 8e29328482

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ryan/lettarrboxd!1
No description provided.