Background long-running actions; confirm destructive ones

- Run now (jobs and playlists), dedup scan, genre preview/apply, and manual
  import now dispatch via BackgroundTasks and redirect immediately, instead
  of awaiting a job that can run for the better part of an hour and hang the
  browser or reverse proxy. Progress shows in the Jobs runs table (which
  already polls); if the pipeline is busy the run records skipped_lock there.
- Fix the import banner, which claimed work was ongoing after the request
  had actually blocked to completion; it now reflects the backgrounded start.
- Add confirmation prompts to the dedup per-row and bulk delete and to
  "Fix genres now", matching the existing confirms on library and playlist
  deletes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
andrew
2026-07-09 14:31:54 -06:00
parent b135f11557
commit 8f1fc458f6
8 changed files with 61 additions and 43 deletions
+4 -3
View File
@@ -8,8 +8,8 @@
</div>
</div>
{% if request.query_params.get('skipped') %}
<div class="notice warning">Didn't run — something else was using the pipeline at that moment (check <a href="/settings/jobs">Jobs</a> for what). Nothing changed; try again in a moment.</div>
{% if request.query_params.get('started') %}
<div class="notice">Started in the background. Reload this page in a bit to see the result below, or watch its progress under <a href="/settings/jobs">Jobs</a>. If the pipeline is busy it will show as skipped there.</div>
{% endif %}
<div class="panel" style="max-width:560px;">
@@ -18,7 +18,8 @@
<form method="post" action="/genres/scan" class="inline">
<button type="submit" class="btn btn-ghost">Preview changes</button>
</form>
<form method="post" action="/genres/apply" class="inline">
<form method="post" action="/genres/apply" class="inline"
onsubmit="return confirm('Overwrite genres across your whole library with what Spotify reports? Locked artists are left alone. Preview first if unsure.')">
<button type="submit" class="btn btn-primary">Fix genres now</button>
</form>
</div>