Skip to content

fix(scheduler): keep cooldown records for the longest configured cooldown period - #34

Open
linmar wants to merge 1 commit into
refringe:developfrom
linmar:fix/cooldown-prune-retention
Open

fix(scheduler): keep cooldown records for the longest configured cooldown period#34
linmar wants to merge 1 commit into
refringe:developfrom
linmar:fix/cooldown-prune-retention

Conversation

@linmar

@linmar linmar commented Aug 16, 2026

Copy link
Copy Markdown

Summary

The daily prune deletes every search_cooldowns row older than the hard-coded cooldownRetention (7 days), regardless of the configured cooldown_period. Any cooldown longer than a week is therefore silently cut to seven days — and because candidates are taken in library order, an instance with a large backlog keeps re-searching the same 7 × daily budget items instead of walking through the backlog.

Observed on a Whisparr (Eros, registered as radarr) instance with ~22k monitored-missing items and a cooldown_period of several weeks: after a week the same ~3k items came up again while the rest were never searched.

Changes

  • internal/scheduler: new cooldownPruneRetention() — the prune keeps records for the longest configured cooldown period (global and every instance), with the previous 7 days as the floor. Settings that fail to load are skipped, so an error can only make the prune less aggressive, never more.
  • Doc comment on cooldownRetention updated to describe it as the floor.
  • Unit test TestCooldownPruneRetentionHonoursConfiguredPeriods (defaults → 7 d floor; longer global; longest per-instance wins).

Related issues

none

Test plan

  • Existing tests pass (make test)
  • New tests added for new functionality
  • Linter passes (make lint — 0 issues)
  • Running in production against 4 instances (sonarr/radarr/lidarr/whisparr) since 2026-08-16

…down period

The daily prune deleted every search_cooldowns row older than the hard-coded
cooldownRetention (7 days), regardless of the configured cooldown_period. Any
cooldown longer than a week was therefore silently cut to seven days, and
because candidates are taken in library order an instance with a large
backlog kept re-searching the same 7 x daily-budget items instead of walking
through the backlog.

The prune now keeps records for the longest configured cooldown period
(global and per instance), with the previous 7 days as the floor. Settings
that fail to load are skipped, so an error can only make the prune less
aggressive.
@linmar
linmar requested a review from refringe as a code owner August 16, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant