fix(server): persistent library on self-hosted web server (no TTL sweep) - #251
Merged
Conversation
The 24h job TTL sweep was only disabled under the desktop shell (STEMDECK_DESKTOP=1). Running the bare web server via run.sh left the sweep active, so it deleted processed tracks older than 24h on startup and hourly, turning saved library entries into "audio no longer available" / out-of-sync (local-file tracks can't be auto-restored). Add STEMDECK_PERSIST_LIBRARY=1 as a second opt-out in _sweep_disabled, and set it by default in run.sh so the self-hosted server behaves like the desktop app (persistent, user-managed library via Trash). Shared/Docker deployments that set neither flag keep the sweep. Overridable with STEMDECK_PERSIST_LIBRARY=0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The 24h job TTL sweep is only disabled under the desktop shell (
STEMDECK_DESKTOP=1). Running the bare web server viarun.shleaves the sweep active, so on startup (and hourly) it deletes any processed job older than 24h. Those tracks then show as "This track's audio is no longer available" / out-of-sync in the library, and local-file tracks can't be auto-restored (the original file isn't kept).Fix
_sweep_disabled()now also opts out whenSTEMDECK_PERSIST_LIBRARY=1, alongside the existing desktop check.run.shsetsSTEMDECK_PERSIST_LIBRARY=1by default, so the self-hosted server behaves like the desktop app: a persistent, user-managed library (disk managed via Trash).STEMDECK_PERSIST_LIBRARY=0. Shared/Docker deployments that set neither flag keep the sweep for disk hygiene.Testing
pytest tests/test_sweep.py-> 7 passed, incl. a newtest_sweep_disabled_under_persistent_library.ruff check+ruff format --checkclean._sweep_disabled()underrun.sh's env: default -> disabled;=0-> enabled.