From b9fc9db537247a681a110028b0e1368eeafc80f2 Mon Sep 17 00:00:00 2001 From: Amadeus Mader Date: Sat, 7 Mar 2026 18:40:21 +0100 Subject: [PATCH] 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. --- Pinchflat_improvements.md | 2 +- lib/pinchflat/fast_indexing/fast_indexing_worker.ex | 2 +- lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Pinchflat_improvements.md b/Pinchflat_improvements.md index 1ea6f0a..f7facb5 100644 --- a/Pinchflat_improvements.md +++ b/Pinchflat_improvements.md @@ -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: diff --git a/lib/pinchflat/fast_indexing/fast_indexing_worker.ex b/lib/pinchflat/fast_indexing/fast_indexing_worker.ex index ed83bf3..cf563b5 100644 --- a/lib/pinchflat/fast_indexing/fast_indexing_worker.ex +++ b/lib/pinchflat/fast_indexing/fast_indexing_worker.ex @@ -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 diff --git a/lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex b/lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex index ae555ff..2f10313 100644 --- a/lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex +++ b/lib/pinchflat/slow_indexing/media_collection_indexing_worker.ex @@ -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