forked from Furumi/furumi-web
Store library imports and run them as a resumable background job
Add the library_import subsystem core: migration m_0065 with the import, playlist, item, publication-receipt and attempt tables, the provider-neutral import model, the adapter trait and the storage layer. The library_import job claims imports under a two-minute lease that a heartbeat renews, checks cancellation between phases and resumes an interrupted import from its stored phase. Matching and publication phases are placeholders for the following changes. At boot, imports of the previous process are requeued; a sweeper starts a worker whenever an import waits without one, so a worker that stops without a server restart is replaced once its lease expires. The /api/imports endpoints list the user's imports, show one import with its playlists and paged entries, cancel it and delete its history while keeping the created playlists. Every request is scoped to the owner. GET /imports redirects to the player view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2a7179702b
commit
097812a845
11 files changed
+3091
No files matched your search
@@ -146,3 +146,15 @@ migrated instance with the import agent disabled at `FURU_TEST_URL` (default
|
||||
`furumi-import-playlist-test-pg` with database `furumi_import_test`, and Playwright
|
||||
and Chrome configured as above. It uses a local torrent preview fixture and
|
||||
simulated imported tracks, without downloading external torrents.
|
||||
|
||||
## Library import tests
|
||||
|
||||
```bash
|
||||
cargo test library_import
|
||||
# Disposable PostgreSQL with ICU support; each test creates and drops a unique schema.
|
||||
FURU_LIBRARY_IMPORT_TEST_DATABASE_URL=postgresql://... cargo test library_import -- --include-ignored
|
||||
```
|
||||
|
||||
The database tests cover per-user isolation, repeated source playlists, exclusive
|
||||
claims, lease ownership, cancellation, history deletion that keeps target playlists,
|
||||
and resumption after a worker stops without a server restart once its lease expires.
|
||||
Reference in new issue
Block a user