[Bugfix] Fix yt-dlp illegal write issue that causes failure to fetch source details (#247)

* Bandaid fix for yt-dlp write issue

* Ensured tempfile directory on app boot
This commit is contained in:
Kieran authored and GitHub committed 2024-05-15 17:32:56 -07:00
1 parent a7b0af65e2
commit b1a6a6a81f
4 files changed
+39 -1

No files matched your search

@@ -31,6 +31,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
"""
@impl true
def init(state) do
ensure_tmpfile_directory()
reset_executing_jobs()
create_blank_yt_dlp_files()
create_blank_user_script_file()
@@ -39,6 +40,14 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
{:ok, state}
end
defp ensure_tmpfile_directory do
tmpfile_dir = Application.get_env(:pinchflat, :tmpfile_directory)
if !File.exists?(tmpfile_dir) do
File.mkdir_p!(tmpfile_dir)
end
end
# If a node cannot gracefully shut down, the currently executing jobs get stuck
# in the "executing" state. This is a problem because the job runner will not
# pick them up again