Merge pull request #30 from MrSleeps/fix/resumable-meili-caption-repair

Make Meilisearch caption-index repair resumable and handle slow tasks
This commit is contained in:
Sleeps
2026-10-08 11:23:36 +01:00
committed by GitHub
5 changed files with 430 additions and 45 deletions
+29 -4
View File
@@ -38,10 +38,35 @@ The command repopulates each affected Meilisearch document with the original
frame ID, Jellyfin video/library IDs, title, timestamp, caption-window
metadata, tags and stored SigLIP embedding from SQLite, waiting for each
Meilisearch task to succeed. It doesn't call Ollama, re-embed frames, clear
Meilisearch or force a whole-library rebuild. If interrupted, simply rerun:
the repair is safe and idempotent. Keep indexing and captioning stopped while
it runs. After completion, test a distinctive saved caption on the standalone
web search and in the Jellyfin plugin diagnostics.
Meilisearch or force a whole-library rebuild.
**Large-index repairs are resumable:** each submitted task ID and the last
confirmed frame ID are saved in the canonical SQLite database. The repair
waits as long as necessary for a busy Meilisearch index rather than aborting
after 120 seconds. Status lines are printed during slow tasks. If you press
Ctrl+C, restart Docker, or lose the terminal, rerun the same `--apply`
command: it will check the existing queued task before moving on and will
not resubmit completed batches.
**Recovering the old task-timeout bug:** if you previously ran the older
repair implementation and it stopped with `Timed out waiting for Meilisearch
task 41758` **before displaying any completed batches**, use:
```bash
docker compose exec -T scene-search python -m scene_search.cli repair-caption-index --apply --resume-task 41758
```
Replace `41758` with the actual task ID from that timeout. The command
verifies the task belongs to the current index, is a document update, and has
the expected number of documents; it waits for the original task rather than
creating a duplicate. If that older task already failed or was canceled,
rerun normally without `--resume-task`. If any earlier batches already
completed under the old script, they might be processed again (harmless,
but may take extra time); only one previously queued task can be adopted.
Keep captioning and library indexing stopped throughout the repair. After
completion, test a distinctive saved caption on the standalone web search
and in Jellyfin plugin diagnostics.
Note: very old orphaned documents no longer associated with any saved caption
or caption window are outside this targeted selection; a full `sync-meili`