fix(oban): add executing state to indexing worker unique constraints

Include :executing in the unique states list for both FastIndexingWorker
and MediaCollectionIndexingWorker. This ensures Oban properly tracks
executing jobs and prevents potential duplicate job issues.

Without :executing in the unique states, the uniqueness check doesn't
consider currently running jobs, which could lead to jobs not appearing
in the UI's active tasks view or duplicate jobs being scheduled.
This commit is contained in:
Amadeus Mader 2026-03-07 18:40:21 +01:00
parent 00eabddfa2
commit b9fc9db537
3 changed files with 3 additions and 3 deletions

View file

@ -159,7 +159,7 @@ docker compose start pinchflat
3. Log more details when indexing jobs fail
4. Consider a health check that identifies sources with stale/null `last_indexed_at`
## Issue 7: SlowIndexing jobs don't show as "executing" in UI
## Issue 7: SlowIndexing jobs don't show as "executing" in UI [COMPLETED]
**Problem:** When `MediaCollectionIndexingWorker` (SlowIndexing) jobs start running, they spawn yt-dlp processes but fail to update their job state from `available` to `executing` in the database. This causes:

View file

@ -3,7 +3,7 @@ defmodule Pinchflat.FastIndexing.FastIndexingWorker do
use Oban.Worker,
queue: :fast_indexing,
unique: [period: :infinity, states: [:available, :scheduled, :retryable]],
unique: [period: :infinity, states: [:available, :scheduled, :retryable, :executing]],
tags: ["media_source", "fast_indexing", "show_in_dashboard"]
require Logger

View file

@ -3,7 +3,7 @@ defmodule Pinchflat.SlowIndexing.MediaCollectionIndexingWorker do
use Oban.Worker,
queue: :media_collection_indexing,
unique: [period: :infinity, states: [:available, :scheduled, :retryable]],
unique: [period: :infinity, states: [:available, :scheduled, :retryable, :executing]],
tags: ["media_source", "media_collection_indexing", "show_in_dashboard"]
require Logger