Skip to content

[Bug] SEARCH_AMOUNT above 100 is silently unreachable - the attempt cap limits the result set, not just the retries #44

Description

@egg82

What happened?

Every updater fills its search list like this:

int attempts = 100;
while (attempts > 0 && resources.size() < searchAmount) {
    attempts--;

    WeightedMovie m = random.selectOne();
    ...

attempts-- runs on every iteration, including the ones that succeed. So a successful selection costs an attempt exactly like a filtered-out one does, and resources.size() can never exceed 100 no matter what SEARCH_AMOUNT says.

Observed on a live Whisparr instance configured with WHISPARR_0_SEARCH_AMOUNT=280:

SEARCH_AMOUNT: 280
selected:      100
skipped:         0

Nothing was filtered - it simply ran out of attempts at exactly 100. The log line still says Updating up to 280 items for WHISPARR_0, and nothing afterwards indicates it stopped at 100.

The filtering case makes it worse rather than causing it. On a Radarr instance with SEARCH_AMOUNT=20 and most of the library unmonitored, 53 candidates were skipped and 20 selected - 73 attempts to fill 20 slots. That one still completed, but at roughly an 80% skip rate even a SEARCH_AMOUNT of 20 would start coming up short.

All five updaters:

What did you expect to happen?

SEARCH_AMOUNT=280 searches 280 items, or the log says why it couldn't.

Steps to reproduce

Set any SEARCH_AMOUNT above 100 on an instance with more than 100 eligible items. Count the "Updating ..." lines - it stops at 100.

Shape of the fix

The cap is there to stop the loop spinning forever when everything is filtered out, which is a real thing to guard against - it just shouldn't be counting successes. Only decrementing on a skip fixes the ceiling while keeping the guard, though it needs the budget to scale with searchAmount rather than being a flat 100, or a large SEARCH_AMOUNT on a heavily-filtered library hits the same wall for the original reason.

Either way a log line when the loop exits on attempts rather than on a full list turns the silent shortfall into something a user can see.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions