Added the bot message to the list of non-retryable errors
This commit is contained in:
parent
ced26f3dd1
commit
de300433c8
2 changed files with 14 additions and 1 deletions
|
|
@ -115,7 +115,7 @@ defmodule Pinchflat.Downloading.MediaDownloadWorker do
|
|||
defp action_on_error(message) do
|
||||
# This will attempt re-download at the next indexing, but it won't be retried
|
||||
# immediately as part of job failure logic
|
||||
non_retryable_errors = ["Video unavailable"]
|
||||
non_retryable_errors = ["Video unavailable", "Sign in to confirm"]
|
||||
|
||||
if String.contains?(to_string(message), non_retryable_errors) do
|
||||
Logger.error("yt-dlp download will not be retried: #{inspect(message)}")
|
||||
|
|
|
|||
|
|
@ -127,6 +127,19 @@ defmodule Pinchflat.Downloading.MediaDownloadWorkerTest do
|
|||
end)
|
||||
end
|
||||
|
||||
test "does not set the job to retryable if youtube thinks you're a bot", %{media_item: media_item} do
|
||||
expect(YtDlpRunnerMock, :run, 2, fn
|
||||
_url, :get_downloadable_status, _opts, _ot, _addl -> {:ok, "{}"}
|
||||
_url, :download, _opts, _ot, _addl -> {:error, "Sign in to confirm you're not a bot", 1}
|
||||
end)
|
||||
|
||||
Oban.Testing.with_testing_mode(:inline, fn ->
|
||||
{:ok, job} = Oban.insert(MediaDownloadWorker.new(%{id: media_item.id, quality_upgrade?: true}))
|
||||
|
||||
assert job.state == "completed"
|
||||
end)
|
||||
end
|
||||
|
||||
test "it ensures error are returned in a 2-item tuple", %{media_item: media_item} do
|
||||
expect(YtDlpRunnerMock, :run, 2, fn
|
||||
_url, :get_downloadable_status, _opts, _ot, _addl -> {:ok, "{}"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue