Skip to content

feat: add setting to skip the theme scan at startup - #693

Merged
ReenigneArcher merged 7 commits into
LizardByte:masterfrom
LuckyNoS7evin:feat/scan-on-boot-env
Nov 2, 2026
Merged

ReenigneArcher merged 7 commits into
LizardByte:masterfrom
LuckyNoS7evin:feat/scan-on-boot-env

Conversation

@LuckyNoS7evin

@LuckyNoS7evin LuckyNoS7evin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a Scan on startup setting (BOOL_SCAN_ON_BOOT, under Settings → Themerr) that lets administrators skip the theme scan when Themerr starts.

When the scheduler starts, schedule_loop runs every job once with schedule.run_all(). That includes the full "Theme scan and queue" job whenever theme updates are enabled. On a large library, or with frequent container restarts, this means a complete scan of every server on each boot.

With this change:

  • The setting defaults to on, so existing installs behave as before. It appears on the Settings page and persists in config.ini like the other Themerr settings.
  • When it's off, startup skips only the theme scan and logs Skipping the startup theme scan because Scan on startup is disabled. The dashboard refresh and the release check still run.
  • The skipped scan still runs on its normal INT_UPDATE_THEMES_INTERVAL schedule.
  • The scheduler reads the setting when it starts, so a change applies the next time Themerr starts.

The scan job gets an extra theme-scan tag, next to themerr, so the loop can find it. DOCKER_README.md tells container users where to find the setting.

Updated after review: this started as a THEMERR_SCAN_ON_BOOT environment variable and is now a regular Themerr setting, as requested.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Tests in tests/unit/themerr/test_scheduled_tasks.py:

  • The setting defaults to enabled.
  • A saved disabled value survives a config reload.
  • With the setting off, schedule_loop dispatches the dashboard refresh but not the theme scan, and the scan job stays scheduled for its next run.

The existing test_schedule_loop still covers the default run_all() path.

  • pytest -o addopts='' -p no:cacheprovider (excluding tests/unit/test_notification_build.py, which needs PyInstaller locally): 1045 passed, 19 skipped
  • flake8 and git diff --check: clean
  • Settings page: checked that it renders the new "Scan on startup" option
  • python scripts/localize.py --extract: adds "Scan on startup" and its description to locale/themerr.po
  • Not run locally: python -m dockle build, because the Dockle submodule and the C# doc toolchain aren't set up here.

Manual (earlier env-var version): built a linux/amd64 image with the startup scan disabled and confirmed the container became healthy and logged the skip message, deployed in Docker against a real Plex and Jellyfin setup.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

Claude Code helped explore the scheduler, implement the change and review follow-ups, and build the test image. I reviewed the changes and tested them on my own server.

@CLAassistant

CLAassistant commented Oct 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Themerr runs every scheduled job once when it starts, including the
full theme scan. Setting THEMERR_SCAN_ON_BOOT=false (or 0/no/off)
skips only that startup scan; the dashboard refresh still runs and
scheduled scans continue at the configured interval. Unset keeps the
current behaviour.

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the configuration integration described inline: startup scanning should be a normal Themerr boolean setting, defaulting to True, with the scheduler reading config.CONFIG.

Reviewed head 34b2fcfeaf353c0bef6e3561e89f7e1034f1f201 against current master (6fcf177ee4fb5388f531fa89203aa012634447cc).

Validation: all 32 targeted scheduler/config tests passed; flake8 on both changed Python files and git diff --check HEAD^ HEAD passed. A separate mocked scheduler check confirmed that disabling startup scanning still dispatches dashboard/release jobs, preserves the scan's initial due time, and dispatches it when due.

Hosted Sonar and Read the Docs checks passed. CI and CodeQL require maintainer approval, so those results are unavailable. Local python -m dockle build stopped because Doxygen is unavailable. No live Docker/media-server validation was performed during this review.

Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh

Comment thread src/themerr/scheduled_tasks.py Resolved
Replace the THEMERR_SCAN_ON_BOOT environment variable with the
BOOL_SCAN_ON_BOOT setting (default on), so it appears on the Settings
page and persists in config.ini. The scheduler reads it at startup.
@LuckyNoS7evin LuckyNoS7evin changed the title feat(docker): add THEMERR_SCAN_ON_BOOT to skip the startup scan feat: add setting to skip the theme scan at startup Oct 30, 2026

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 3cc471f797ff3192ce7935a316843719e64bfba6, including the follow-up since 34b2fcf and the complete PR diff. The original request to use persisted configuration is addressed: the setting defaults to enabled, appears through the existing Settings schema, and has config-reload coverage.

Two maintainer-requested cleanup changes remain, detailed inline:

  • Revert DOCKER_README.md entirely.
  • Remove scan_on_boot() and read config.CONFIG['Themerr']['BOOL_SCAN_ON_BOOT'] directly in schedule_loop().

These are cleanup requests; I found no additional runtime defect.

Validation: all 25 focused scheduler/config tests passed; flake8 on all three changed Python files and git diff --check passed. A separate mocked scheduler check verified that disabling startup scanning preserves dashboard/release startup jobs and later scheduled scans. Latest master (1c47d32) only adds a Swagger UI dependency update since the PR base.

Hosted Sonar and Read the Docs checks passed. CI and CodeQL still require maintainer approval. The local documentation build stopped because Doxygen is unavailable. Validation covers the submitted head; the inline cleanup suggestions were not applied locally.

Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh

Comment thread DOCKER_README.md Resolved
Comment thread src/themerr/scheduled_tasks.py Resolved
LuckyNoS7evin and others added 4 commits November 1, 2026 20:33
Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com>
Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com>
Removed the scan_on_boot function that checks if the theme scan should run on startup.

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed b6775e1b77a97c4022fcd6a58a72cf919fddc1b8 against current master (94a43a1), including the changes since the last reviewed head 3cc471f and the complete PR diff.

The Docker README now matches the target branch, and the scheduler reads the config directly without a helper. One follow-up defect remains: two regression tests still call the deleted scan_on_boot() function.

The submitted head produced 2 failed, 23 passed across the scheduler/config tests. Both failures are AttributeError at the stale helper calls. The inline suggestion removes those calls while retaining the default/persistence assertions; all 25 tests passed when I verified that suggestion in the temporary review checkout, then restored the submitted file.

Flake8 and git diff --check passed. A separate mocked scheduler check confirmed that disabling the startup scan preserves dashboard/release startup jobs and later scheduled scans. Hosted Sonar and Read the Docs checks passed. CI and CodeQL await maintainer approval; the local documentation build remains blocked by missing Doxygen.

Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh

oh fudge sake, that will teach me to use github suggestions

Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.14%. Comparing base (94a43a1) to head (3198a02).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #693      +/-   ##
==========================================
+ Coverage   89.13%   89.14%   +0.01%     
==========================================
  Files          77       77              
  Lines        6368     6375       +7     
  Branches      904      907       +3     
==========================================
+ Hits         5676     5683       +7     
  Misses        478      478              
  Partials      214      214              
Flag Coverage Δ
Linux-aarch64 88.91% <100.00%> (+0.01%) ⬆️
Linux-x86_64 88.91% <100.00%> (+0.01%) ⬆️
Windows-AMD64 88.98% <100.00%> (+0.01%) ⬆️
Windows-ARM64 88.98% <100.00%> (+0.01%) ⬆️
jellyfin-connector 90.24% <ø> (ø)
macOS-arm64 88.91% <100.00%> (+0.01%) ⬆️
macOS-x86_64 88.91% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/common/config.py 81.34% <ø> (ø)
src/themerr/scheduled_tasks.py 95.83% <100.00%> (+0.44%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94a43a1...3198a02. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ReenigneArcher
ReenigneArcher merged commit 72fb8c0 into LizardByte:master Nov 2, 2026
30 checks passed
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.

3 participants