Skip to content

fix(server): persistent library on self-hosted web server (no TTL sweep) - #251

Merged
thcp merged 1 commit into
mainfrom
fix/web-server-persistent-library
Jul 10, 2026
Merged

fix(server): persistent library on self-hosted web server (no TTL sweep)#251
thcp merged 1 commit into
mainfrom
fix/web-server-persistent-library

Conversation

@thcp

@thcp thcp commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

The 24h job TTL sweep is only disabled under the desktop shell (STEMDECK_DESKTOP=1). Running the bare web server via run.sh leaves 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 when STEMDECK_PERSIST_LIBRARY=1, alongside the existing desktop check.
  • run.sh sets STEMDECK_PERSIST_LIBRARY=1 by default, so the self-hosted server behaves like the desktop app: a persistent, user-managed library (disk managed via Trash).
  • Overridable with 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 new test_sweep_disabled_under_persistent_library.
  • ruff check + ruff format --check clean.
  • Verified the real _sweep_disabled() under run.sh's env: default -> disabled; =0 -> enabled.

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.
@thcp
thcp marked this pull request as ready for review July 10, 2026 19:40
@thcp
thcp merged commit 8d816b1 into main Jul 10, 2026
8 checks passed
@thcp
thcp deleted the fix/web-server-persistent-library branch July 10, 2026 19:41
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