From bbe0d7c630bb44e1d27a4d67905ac938e6009ecd Mon Sep 17 00:00:00 2001 From: Eric Teubert Date: Mon, 30 Dec 2024 21:55:55 +0800 Subject: [PATCH] change: upload media after metadata just so we have some metadata even if file upload fails --- server/lib/publisher/wordpress/episode.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/lib/publisher/wordpress/episode.ex b/server/lib/publisher/wordpress/episode.ex index ea2a13b..65496e0 100644 --- a/server/lib/publisher/wordpress/episode.ex +++ b/server/lib/publisher/wordpress/episode.ex @@ -11,10 +11,10 @@ defmodule Publisher.WordPress.Episode do post_id <- fetch_post_id(req, episode_id), {:ok, _} <- write_episode_meta(req, episode_id, params), :ok <- upload_content(req, post_id, params), - :ok <- upload_media(req, episode_id, post_id, params), :ok <- upload_chapters(req, episode_id, params), :ok <- upload_transcript(req, episode_id, params), :ok <- upload_contributors(req, episode_id, params), + :ok <- upload_media(req, episode_id, post_id, params), :ok <- verify_media(req, episode_id), :ok <- upload_cover(req, episode_id, post_id, params) do :ok @@ -334,6 +334,7 @@ defmodule Publisher.WordPress.Episode do {:ok, resp} = Req.get(enclosure_url) + # TODO: increase timeout or handle error, maybe retry {:ok, upload} = Req.post(req, url: "wp/v2/media",