Updated default job priorities for downloading queue
This commit is contained in:
parent
704d29dc7e
commit
8c8be10083
3 changed files with 14 additions and 6 deletions
|
|
@ -47,7 +47,7 @@ config :pinchflat, Pinchflat.Repo,
|
||||||
config :pinchflat, Oban,
|
config :pinchflat, Oban,
|
||||||
queues: [
|
queues: [
|
||||||
default: 10,
|
default: 10,
|
||||||
fast_indexing: 6,
|
fast_indexing: yt_dlp_worker_count,
|
||||||
media_collection_indexing: yt_dlp_worker_count,
|
media_collection_indexing: yt_dlp_worker_count,
|
||||||
media_fetching: yt_dlp_worker_count,
|
media_fetching: yt_dlp_worker_count,
|
||||||
remote_metadata: yt_dlp_worker_count,
|
remote_metadata: yt_dlp_worker_count,
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ defmodule Pinchflat.Downloading.MediaDownloadWorker do
|
||||||
|
|
||||||
use Oban.Worker,
|
use Oban.Worker,
|
||||||
queue: :media_fetching,
|
queue: :media_fetching,
|
||||||
|
priority: 5,
|
||||||
unique: [period: :infinity, states: [:available, :scheduled, :retryable, :executing]],
|
unique: [period: :infinity, states: [:available, :scheduled, :retryable, :executing]],
|
||||||
tags: ["media_item", "media_fetching", "show_in_dashboard"]
|
tags: ["media_item", "media_fetching", "show_in_dashboard"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,20 @@ defmodule Pinchflat.Downloading.MediaDownloadWorkerTest do
|
||||||
assert_enqueued(worker: MediaDownloadWorker, args: %{"id" => media_item.id, "force" => true})
|
assert_enqueued(worker: MediaDownloadWorker, args: %{"id" => media_item.id, "force" => true})
|
||||||
end
|
end
|
||||||
|
|
||||||
test "can be called with additional job options", %{media_item: media_item} do
|
test "has a priority of 5 by default", %{media_item: media_item} do
|
||||||
job_opts = [max_attempts: 5]
|
assert {:ok, _} = MediaDownloadWorker.kickoff_with_task(media_item)
|
||||||
|
|
||||||
assert {:ok, _} = MediaDownloadWorker.kickoff_with_task(media_item, %{}, job_opts)
|
|
||||||
|
|
||||||
[job] = all_enqueued(worker: MediaDownloadWorker, args: %{"id" => media_item.id})
|
[job] = all_enqueued(worker: MediaDownloadWorker, args: %{"id" => media_item.id})
|
||||||
assert job.max_attempts == 5
|
|
||||||
|
assert job.priority == 5
|
||||||
|
end
|
||||||
|
|
||||||
|
test "priority can be set", %{media_item: media_item} do
|
||||||
|
assert {:ok, _} = MediaDownloadWorker.kickoff_with_task(media_item, %{}, priority: 0)
|
||||||
|
|
||||||
|
[job] = all_enqueued(worker: MediaDownloadWorker, args: %{"id" => media_item.id})
|
||||||
|
|
||||||
|
assert job.priority == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue