Maintainerr icon indicating copy to clipboard operation
Maintainerr copied to clipboard

Seerr getter returns null per-item under load on large libraries — Seerr-seeded rules silently match almost nothing

Open area51tazz opened this issue 5 months ago • 3 comments

Describe the bug

On a large library, rules that depend on a Seerr property (e.g. Seerr - Requested in Seerr) match almost nothing, because the Seerr getter returns null for most items during a full run. The comparator treats a null first value as a missing operand and skips the rule for that item, so a rule like isRequested = false AND not watchlisted ends up matching only the handful of items whose Seerr lookup happened to succeed that run.

Root cause

SeerrGetterService.get() makes a per-item seerrApi.getMovie() / getShow() call. Under the request volume of a whole-library run these calls fail/rate-limit and the response comes back without mediaInfo, so the getter hits its else branch and returns null (Couldn't fetch Seerr metadata for media '<title>' … no Seerr query could be made).

The per-item-API-hammering problem was recognized and fixed in #2580 / #2936 by introducing bulk prefetch/caching — but that work covered the Plex / Tautulli / Sonarr / Radarr getters and not the Seerr getter. getter.service.ts still routes Application.SEERR straight to a per-item seerrGetter.get(), with no prefetch or cache layer.

Evidence (v3.15.2, ~1,150-movie Plex library, Overseerr/seerr)

  • A single run of a rule seeded on Seerr: Requested = false logged 278 unique titles with Couldn't fetch Seerr metadata … no Seerr query could be made → firstValue=null → Skipping rule comparison because a value is unavailable. Only 2 items survived to the collection.
  • The same titles resolve correctly when evaluated individually via POST /api/rules/test — e.g. Shazam! returns isRequested: 0 in the single-item test, yet appears in the bulk-run failure log. This confirms it's load/rate-limit dependent, not missing/unmatched data.
  • A functionally-equivalent rule reseeded on Plex-only properties (Times viewed, Last view date) with the same watchlist exclusion matched 155 items reliably on the same library — i.e. the Plex and watchlist getters scale fine; only the Seerr getter does not.

Expected behavior

The Seerr getter should resolve request data reliably on large libraries — e.g. fetch/cache it once per run (bulk prefetch, as the other getters now do), or at minimum add retry/back-off — so Seerr-seeded rules don't silently degrade to near-zero matches.

Version

3.15.2 (self-hosted; Plex media server + Overseerr/seerr request service).

area51tazz avatar Jun 22 '26 18:06 area51tazz

Thanks for the detailed issue!

Will have a look, you're right, Seerr should also share the same improvements!

enoch85 avatar Jun 23 '26 18:06 enoch85

Benchmark — per-item getMovie vs one bulk /request sweep, against a real Seerr (50K-item library):

Path Items Seerr HTTP requests Time Errors
Before — 1 /movie call per item 30,000 of 50,000 (stopped early) 30,000 ~157 s 26,502 (88%)
After — 1 bulk /request sweep 50,000 2 ~0.1 s 0

Before error breakdown: 3,498 OK · 880 rate-limited (HTTP 500) · 8 socket · 25,614 connection refused.

Notes:

  • I stopped Before at 30K because it was knocking the real Seerr over (connection-refused). 50K would only be worse.
  • After's 0.1 s = 2 real network calls + 50,000 in-memory lookups — not 50,000 network calls. That's the fix.
  • The real Seerr only had 102 requests (101 titles), so 2 pages of 100 fetched all of them. Page count grows with how many requests exist, not with library size.

Fix in #3170.

enoch85 avatar Jun 25 '26 05:06 enoch85

:tada: This issue has been resolved in version 3.16.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

maintainerr-automation avatar Jun 28 '26 07:06 maintainerr-automation