From 14e23a43712b18cbcc378cc157f36690aa9e8289 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Dec 2023 13:22:05 +0700 Subject: [PATCH] handle reindex item delete during task run --- tubearchivist/home/src/index/reindex.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tubearchivist/home/src/index/reindex.py b/tubearchivist/home/src/index/reindex.py index 224e542..d320c9e 100644 --- a/tubearchivist/home/src/index/reindex.py +++ b/tubearchivist/home/src/index/reindex.py @@ -292,6 +292,9 @@ class Reindex(ReindexBase): # read current state video.get_from_es() + if not video.json_data(): + return + es_meta = video.json_data.copy() # get new @@ -329,6 +332,9 @@ class Reindex(ReindexBase): # read current state channel = YoutubeChannel(channel_id) channel.get_from_es() + if not channel.json_data: + return + es_meta = channel.json_data.copy() # get new @@ -357,6 +363,9 @@ class Reindex(ReindexBase): self._get_all_videos() playlist = YoutubePlaylist(playlist_id) playlist.get_from_es() + if not playlist.json_data: + return + subscribed = playlist.json_data["playlist_subscribed"] playlist.all_youtube_ids = self.all_indexed_ids playlist.build_json(scrape=True)