handle reindex item delete during task run

This commit is contained in:
Simon 2023-12-21 13:22:05 +07:00
parent fe8f4faa10
commit 14e23a4371
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -292,6 +292,9 @@ class Reindex(ReindexBase):
# read current state # read current state
video.get_from_es() video.get_from_es()
if not video.json_data():
return
es_meta = video.json_data.copy() es_meta = video.json_data.copy()
# get new # get new
@ -329,6 +332,9 @@ class Reindex(ReindexBase):
# read current state # read current state
channel = YoutubeChannel(channel_id) channel = YoutubeChannel(channel_id)
channel.get_from_es() channel.get_from_es()
if not channel.json_data:
return
es_meta = channel.json_data.copy() es_meta = channel.json_data.copy()
# get new # get new
@ -357,6 +363,9 @@ class Reindex(ReindexBase):
self._get_all_videos() self._get_all_videos()
playlist = YoutubePlaylist(playlist_id) playlist = YoutubePlaylist(playlist_id)
playlist.get_from_es() playlist.get_from_es()
if not playlist.json_data:
return
subscribed = playlist.json_data["playlist_subscribed"] subscribed = playlist.json_data["playlist_subscribed"]
playlist.all_youtube_ids = self.all_indexed_ids playlist.all_youtube_ids = self.all_indexed_ids
playlist.build_json(scrape=True) playlist.build_json(scrape=True)